pub struct Parser {
pub bytes_encoding: BytesEncoding,
}
Expand description
A protobuf parser that converts protobuf messages to JSON.
Fields§
§bytes_encoding: BytesEncoding
How to encode bytes fields when converting to JSON.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn with_bytes_encoding(bytes_encoding: BytesEncoding) -> Self
pub fn with_bytes_encoding(bytes_encoding: BytesEncoding) -> Self
Create a new parser with the given bytes encoding method.
Sourcepub fn parse(&self, data: &[u8]) -> Option<Value>
pub fn parse(&self, data: &[u8]) -> Option<Value>
Parse a protobuf message from the given byte slice and convert it to JSON.
Sourcepub fn parse_once<'a>(&self, data: &'a [u8]) -> Message<'a>
pub fn parse_once<'a>(&self, data: &'a [u8]) -> Message<'a>
Parse a protobuf message from the given byte slice without recursion.
Trait Implementations§
impl Eq for Parser
impl StructuralPartialEq for Parser
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more