pub struct Document { /* private fields */ }Implementations§
Source§impl Document
impl Document
pub fn new( schema: u64, version: u32, generation: u64, ) -> Result<Document, SaveError>
pub fn schema(&self) -> u64
pub fn version(&self) -> u32
pub fn generation(&self) -> u64
pub fn fields(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn get(&self, key: &str) -> Option<&Value>
Sourcepub fn set(&mut self, key: &str, value: Value) -> Result<(), SaveError>
pub fn set(&mut self, key: &str, value: Value) -> Result<(), SaveError>
Replacements validate before mutation. Keys sort canonically on disk.
pub fn u64(&self, key: &str) -> Result<u64, SaveError>
pub fn i64(&self, key: &str) -> Result<i64, SaveError>
pub fn f64(&self, key: &str) -> Result<f64, SaveError>
pub fn boolean(&self, key: &str) -> Result<bool, SaveError>
pub fn text(&self, key: &str) -> Result<&str, SaveError>
pub fn bytes(&self, key: &str) -> Result<&[u8], SaveError>
pub fn encode(&self) -> Vec<u8> ⓘ
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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