pub struct InlineValueCodec;Expand description
Inline value encoder/decoder
Implementations§
Source§impl InlineValueCodec
impl InlineValueCodec
Sourcepub const MAX_INLINE_INT: i64
pub const MAX_INLINE_INT: i64
Maximum safe integer for inline encoding (2^52)
Sourcepub const MIN_INLINE_INT: i64
pub const MIN_INLINE_INT: i64
Minimum safe integer for inline encoding (-2^52)
Sourcepub const MAX_INLINE_STRING_LEN: usize = 7
pub const MAX_INLINE_STRING_LEN: usize = 7
Maximum string length for inline encoding (7 bytes)
Sourcepub fn try_encode_integer(value: i64) -> Option<NodeId>
pub fn try_encode_integer(value: i64) -> Option<NodeId>
Try to encode an integer as inline value
Returns Some(NodeId) if the integer can be inlined, None otherwise.
Sourcepub fn decode_integer(node_id: NodeId) -> i64
pub fn decode_integer(node_id: NodeId) -> i64
Decode an inline integer
Panics if the NodeId is not an inline integer.
Sourcepub fn try_encode_boolean(value: bool) -> Option<NodeId>
pub fn try_encode_boolean(value: bool) -> Option<NodeId>
Try to encode a boolean as inline value
Sourcepub fn decode_boolean(node_id: NodeId) -> bool
pub fn decode_boolean(node_id: NodeId) -> bool
Decode an inline boolean
Sourcepub fn try_encode_decimal(value: f64) -> Option<NodeId>
pub fn try_encode_decimal(value: f64) -> Option<NodeId>
Try to encode a decimal value as inline
Encodes decimals with limited precision (32-bit mantissa, 16-bit exponent)
Sourcepub fn decode_decimal(node_id: NodeId) -> f64
pub fn decode_decimal(node_id: NodeId) -> f64
Decode an inline decimal
Sourcepub fn try_encode_small_string(value: &str) -> Option<NodeId>
pub fn try_encode_small_string(value: &str) -> Option<NodeId>
Try to encode a small string as inline value
Only strings up to 7 bytes (ASCII/UTF-8) can be inlined.
Sourcepub fn decode_small_string(node_id: NodeId) -> String
pub fn decode_small_string(node_id: NodeId) -> String
Decode an inline small string
Sourcepub fn inline_stats(node_id: NodeId) -> InlineValueStats
pub fn inline_stats(node_id: NodeId) -> InlineValueStats
Get inline value statistics
Auto Trait Implementations§
impl Freeze for InlineValueCodec
impl RefUnwindSafe for InlineValueCodec
impl Send for InlineValueCodec
impl Sync for InlineValueCodec
impl Unpin for InlineValueCodec
impl UnsafeUnpin for InlineValueCodec
impl UnwindSafe for InlineValueCodec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more