pub enum Mark {
}Expand description
An indicator of what’s contained in the value.
This is the first thing that is read/written in mbon, and it will tell the reader how to read the value that the mark represents.
Variants§
Long
Int
Short
Char
Float
Double
Bytes(usize)
Str(usize)
Object(usize)
Enum(Box<Mark>)
Null
Array(usize, Box<Mark>)
List(usize)
Dict(usize, Box<Mark>, Box<Mark>)
Map(usize)
Implementations§
Source§impl Mark
impl Mark
Sourcepub fn mark_size(&self) -> usize
pub fn mark_size(&self) -> usize
Get the size in bytes that the mark will use in binary form
use mbon::data::Mark;
assert_eq!(Mark::Int.mark_size(), 1);Sourcepub fn data_size(&self) -> usize
pub fn data_size(&self) -> usize
Get the size in bytes that the data will use in binary form
use mbon::data::Mark;
assert_eq!(Mark::Int.data_size(), 4);Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Get the total size in bytes that this value uses in binary form
use mbon::data::Mark;
assert_eq!(Mark::Int.size(), 5);Sourcepub fn from_value(val: impl AsRef<Value>) -> Self
pub fn from_value(val: impl AsRef<Value>) -> Self
Get the mark from a value
use mbon::data::{Mark, Value};
assert_eq!(Mark::from_value(Value::Int(32)), Mark::Int);
assert_eq!(
Mark::from_value(Value::Str("Hello".to_owned())),
Mark::Str(5)
);Trait Implementations§
impl Eq for Mark
impl StructuralPartialEq for Mark
Auto Trait Implementations§
impl Freeze for Mark
impl RefUnwindSafe for Mark
impl Send for Mark
impl Sync for Mark
impl Unpin for Mark
impl UnsafeUnpin for Mark
impl UnwindSafe for Mark
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