| Crates.io | protobuf-core |
| lib.rs | protobuf-core |
| version | 0.2.1 |
| created_at | 2025-10-15 10:25:25.248119+00 |
| updated_at | 2026-01-12 23:41:30.870915+00 |
| description | A primitive utility library for Protocol Buffers in Rust |
| homepage | |
| repository | https://github.com/wada314/protobuf-core |
| max_upload_size | |
| id | 1884137 |
| size | 166,248 |
A primitive utility library for Protocol Buffers in Rust.
This library provides common definitions, constants, enums, and basic logic for implementing Protocol Buffers. It is designed to minimize entry barriers for developers who want to implement Protocol Buffers functionality.
Add this to your Cargo.toml:
[dependencies]
protobuf-core = "0.2.0"
read (enabled by default): Enables field reading utilitieswrite (enabled by default): Enables field writing utilitiesYou can use features independently:
[dependencies]
protobuf-core = { version = "0.2.1", default-features = false, features = ["read"] }
use protobuf_core::{Field, IteratorExtProtobuf};
let bytes = vec![0x08, 0x96, 0x01]; // field 1: 150
let fields: Vec<Field<Vec<u8>>> = bytes
.into_iter()
.protobuf_fields()
.collect::<Result<Vec<Field<Vec<u8>>>, _>>()
.unwrap();
use protobuf_core::{WriteExtProtobuf, Field, FieldValue, FieldNumber};
let mut buffer = Vec::new();
let field: Field<Vec<u8>> = Field::new(
FieldNumber::try_from(1)?,
FieldValue::from_uint64(150)
);
buffer.write_protobuf_field(&field)?;
# Ok::<(), protobuf_core::ProtobufError>(())
This library provides building blocks for implementing Protocol Buffers, not a complete message parser or serializer. It focuses on:
thiserror for error handlingFor comprehensive API documentation, see docs.rs.
Licensed under the Apache License, Version 2.0.