{"id":13730471,"url":"https://github.com/fraillt/bitsery","last_synced_at":"2025-05-14T18:02:40.464Z","repository":{"id":39459513,"uuid":"81011277","full_name":"fraillt/bitsery","owner":"fraillt","description":"Your binary serialization library","archived":false,"fork":false,"pushed_at":"2025-02-09T13:21:02.000Z","size":789,"stargazers_count":1153,"open_issues_count":9,"forks_count":94,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-14T18:02:38.326Z","etag":null,"topics":["binary-serialization","cpp11","cpp14","serialization"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fraillt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-05T18:08:17.000Z","updated_at":"2025-05-10T13:24:52.000Z","dependencies_parsed_at":"2024-01-03T01:19:58.817Z","dependency_job_id":"80ea07a1-6baf-4d95-aff2-c0505407d28e","html_url":"https://github.com/fraillt/bitsery","commit_stats":{"total_commits":99,"total_committers":21,"mean_commits":4.714285714285714,"dds":0.3232323232323232,"last_synced_commit":"d1a47e06e2104b195a19c73b61f1d5c1dceaa228"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraillt%2Fbitsery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraillt%2Fbitsery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraillt%2Fbitsery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraillt%2Fbitsery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraillt","download_url":"https://codeload.github.com/fraillt/bitsery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-serialization","cpp11","cpp14","serialization"],"created_at":"2024-08-03T02:01:15.286Z","updated_at":"2025-05-14T18:02:40.437Z","avatar_url":"https://github.com/fraillt.png","language":"C++","readme":"# Bitsery\n\n[![Build On Windows](https://github.com/fraillt/bitsery/actions/workflows/on_windows.yml/badge.svg)](https://github.com/fraillt/bitsery/actions/workflows/on_windows.yml)\n[![Build On Mac](https://github.com/fraillt/bitsery/actions/workflows/on_mac.yml/badge.svg)](https://github.com/fraillt/bitsery/actions/workflows/on_mac.yml)\n[![Build On Linux](https://github.com/fraillt/bitsery/actions/workflows/on_linux.yml/badge.svg)](https://github.com/fraillt/bitsery/actions/workflows/on_linux.yml)\n[![Join the chat at https://gitter.im/bitsery/Lobby](https://badges.gitter.im/bitsery/Lobby.svg)](https://gitter.im/bitsery/Lobby)\n\nHeader only C++ binary serialization library.\nIt is designed around the networking requirements for real-time data delivery, especially for games.\n\nAll cross-platform requirements are enforced at compile time, so serialized data do not store any meta-data information and is as small as possible.\n\n\u003e **bitsery** is looking for your feedback on [gitter](https://gitter.im/bitsery/Lobby)\n\n## Features\n\n* Cross-platform compatible.\n* Optimized for speed and space.\n* No code generation required: no IDL or metadata, just use your types directly.\n* Configurable runtime error checking on deserialization.\n* Can read/write from any source: stream (file, network stream. etc... ), or buffer (vector, c-array, etc...).\n* Don't pay for what you don't use! - customize your serialization via **extensions**. Some notable *extensions* allow:\n  * fine-grained bit-level serialization control.\n  * forward/backward compatibility for your types.\n  * smart and raw pointers with allocators support and customizable runtime polymorphism.\n* Easily extendable for any type.\n* Allows brief (similar to [cereal](https://uscilab.github.io/cereal/)) or/and verbose syntax for better serialization control.\n* Configurable endianness support.\n* No macros.\n\n## Why use bitsery\n\nLook at the numbers and features list, and decide yourself.\n\n| library     | data size | ser time | des time |\n| ----------- | --------- | -------- | -------- |\n| bitsery     | 6913B     | 1119ms   | 1166ms   |\n| boost       | 11037B    | 15391ms  | 12912ms  |\n| cereal      | 10413B    | 10518ms  | 10245ms  |\n| flatbuffers | 14924B    | 9075ms   | 3701ms   |\n| msgpack     | 8857B     | 3340ms   | 13842ms  |\n| protobuf    | 10018B    | 21229ms  | 22077ms  |\n| yas         | 10463B    | 2107ms   | 1554ms   |\n\n*benchmarked on Ubuntu with GCC 10.3.0, more details can be found [here](https://github.com/fraillt/cpp_serializers_benchmark.git)*\n\nIf still not convinced read more in library [motivation](doc/design/README.md) section.\n\n## Usage example\n```cpp\n#include \u003cbitsery/bitsery.h\u003e\n#include \u003cbitsery/adapter/buffer.h\u003e\n#include \u003cbitsery/traits/vector.h\u003e\n\nenum class MyEnum:uint16_t { V1,V2,V3 };\nstruct MyStruct {\n    uint32_t i;\n    MyEnum e;\n    std::vector\u003cfloat\u003e fs;\n};\n\ntemplate \u003ctypename S\u003e\nvoid serialize(S\u0026 s, MyStruct\u0026 o) {\n    s.value4b(o.i);\n    s.value2b(o.e);\n    s.container4b(o.fs, 10);\n}\n\nusing Buffer = std::vector\u003cuint8_t\u003e;\nusing OutputAdapter = bitsery::OutputBufferAdapter\u003cBuffer\u003e;\nusing InputAdapter = bitsery::InputBufferAdapter\u003cBuffer\u003e;\n\nint main() {\n    MyStruct data{8941, MyEnum::V2, {15.0f, -8.5f, 0.045f}};\n    MyStruct res{};\n\n    Buffer buffer;\n\n    auto writtenSize = bitsery::quickSerialization\u003cOutputAdapter\u003e(buffer, data);\n    auto state = bitsery::quickDeserialization\u003cInputAdapter\u003e({buffer.begin(), writtenSize}, res);\n\n    assert(state.first == bitsery::ReaderError::NoError \u0026\u0026 state.second);\n    assert(data.fs == res.fs \u0026\u0026 data.i == res.i \u0026\u0026 data.e == res.e);\n}\n```\nFor more details go directly to [quick start](doc/tutorial/hello_world.md) tutorial.\n\n## How to use it\nThis documentation comprises these parts:\n* [Tutorial](doc/tutorial/README.md) - getting started.\n* [Reference section](doc/README.md) - all the details.\n\n*documentation is in progress, most parts are empty, but [contributions](CONTRIBUTING.md) are welcome.*\n\n## Requirements\n\nWorks with C++11 compiler, no additional dependencies, include `\u003cbitsery/bitsery.h\u003e` and you're done.\n\n\u003e some **bitsery** extensions might require higher C++ standard (e.g. `StdVariant`)\n\n## Platforms\n\nLibrary is tested on all major compilers on Windows, Linux and macOS.\n\nThere is a patch that allows using bitsery with non-fully compatible C++11 compilers.\n* CentOS 7 with gcc 4.8.2.\n\n## License\n\n**bitsery** is licensed under the [MIT license](LICENSE).\n","funding_links":[],"categories":["Serialization","Objects","正则表达式","C++"],"sub_categories":["Saving/Loading Objects, Compositing Packets","序列化"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraillt%2Fbitsery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraillt%2Fbitsery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraillt%2Fbitsery/lists"}