Comments (4)
This can only be answered for a pair (schema, protocol). For example in Compact Binary almost all types are variable length, the only exceptions are bool
, float
and double
and 8-bit integers. In Fast Binary all integer are fixed size. Furthermore most protocols omit optional fields that are set to default value.
There is no such API.
from bond.
Can be done from outside of Bond internals? (If there is no such API).
Is there any intention to provide such an API?
If possible how?
from bond.
The rules for determining if a schema is const length for a given protocol would have to hardcoded per protocol. There is no way to determine it programmatically. One could in theory imagine some way to encoding this as protocol metadata but I think it would only make sense to add if Bond itself had some feature taking advantage of fixed size fields.
As for determining what the size of a fixed length schema is, the easiest way would be to serialize an instance (e.g. default instance) to a stream that just counts bytes. We have a stream like that implemented in C++ and use it to calculate lengths in the first pass of Compact Binary v2 serialization.
from bond.
Yes, I was actually thinking into implementing our own SimpleFastProtocol disallowing variable size types altogether; where we can estimate that without much problems. The solution used in C++ would also work, we use counting streams ourselves too.
from bond.
Related Issues (20)
- [C#] Support System.Collections.Immutable collections as custom containers
- [C++] How do we deserialize two continuous objects from one bulk of memory? HOT 2
- In C# implementation, how to parse to structs separated by BT_STOP_BASE HOT 2
- Correct way to read list of mapped values in C# HOT 3
- [ci] Image cleanup script needs to handle 18.04 images
- [ci] CI image Dockerfile needs to be paramatarized on FROM registry
- This repo is missing important files
- c#: Add ToString() implementations for compiled bond objects HOT 1
- Merge API support for C#? HOT 2
- Bond generated headers don't work for clang in c++20 HOT 2
- Include enums in Bond runtime schema HOT 1
- cmake/Config.cmake looks for the EOLed Python-2.7 HOT 1
- Deserialization/serialization under Linux is 7x-10x slower than Windows HOT 2
- [C#] gbc.exe: Exec format error inside mcr.microsoft.com/dotnet/sdk:latest docker image. HOT 3
- "openFile: does not exist (No such file or directory)" on Linux HOT 3
- [C#] Deserializing bond-like strings into dynamic type HOT 2
- Linux build error - ghc: panic! HOT 4
- Support dotnet trimming HOT 5
- Target `netstandard2.0` for c# HOT 1
- C++: GCC: Double/Float comparison warning HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bond.