pub struct SparseRoot<S: DeserializeOwned + Serialize + SparsableTrait> { /* private fields */ }Expand description
§A structure to hold the root document as well as its state.
Implementations§
Source§impl<S: DeserializeOwned + Serialize + SparsableTrait> SparseRoot<S>
impl<S: DeserializeOwned + Serialize + SparsableTrait> SparseRoot<S>
pub fn state(&self) -> &Rc<RefCell<SparseState>>
pub fn metadata(&self) -> &SparseMetadata
Source§impl<S> SparseRoot<S>
impl<S> SparseRoot<S>
Sourcepub fn check_version(&self) -> Result<(), SparseError>
pub fn check_version(&self) -> Result<(), SparseError>
Get the value this selector is managing, either by deserializing the pointed value or by directly returning the owned value.
Sourcepub fn root_get(&self) -> Result<SparseValue<'_, S>, SparseError>
pub fn root_get(&self) -> Result<SparseValue<'_, S>, SparseError>
Get the value this selector is managing, either by deserializing the pointed value or by directly returning the owned value.
Sourcepub fn root_get_mut(&mut self) -> Result<SparseValueMut<'_, S>, SparseError>
pub fn root_get_mut(&mut self) -> Result<SparseValueMut<'_, S>, SparseError>
Like root_get but return a mutable reference
Sourcepub fn root_self_reset(&mut self) -> Result<(), SparseError>
pub fn root_self_reset(&mut self) -> Result<(), SparseError>
Reset the root object in case of initialization or update
Sourcepub fn sparse_init(&mut self) -> Result<(), SparseError>
pub fn sparse_init(&mut self) -> Result<(), SparseError>
Intitialize the inner state
Sourcepub fn sparse_updt(&mut self) -> Result<(), SparseError>
pub fn sparse_updt(&mut self) -> Result<(), SparseError>
Update the inner state
Sourcepub fn new_from_file(path: PathBuf) -> Result<Self, SparseError>
pub fn new_from_file(path: PathBuf) -> Result<Self, SparseError>
Create a new SparseRoot from file path
Sourcepub fn new_from_value(
rval: Value,
path: PathBuf,
others: Vec<(Value, PathBuf)>,
) -> Result<Self, SparseError>
pub fn new_from_value( rval: Value, path: PathBuf, others: Vec<(Value, PathBuf)>, ) -> Result<Self, SparseError>
Create a new SparseRoot from a Value object
Sourcepub fn new_from_obj(
rval: S,
path: PathBuf,
others: Vec<(&mut S, PathBuf)>,
) -> Result<Self, SparseError>
pub fn new_from_obj( rval: S, path: PathBuf, others: Vec<(&mut S, PathBuf)>, ) -> Result<Self, SparseError>
Create a new SparseRoot from a serialized object
Sourcepub fn save_to_disk(
&self,
format: Option<SparseFileFormat>,
) -> Result<(), SparseError>
pub fn save_to_disk( &self, format: Option<SparseFileFormat>, ) -> Result<(), SparseError>
Save the state to disk in the specified format. If not format is specified, the format in which the document was read will be used. If the document was read from memory, it’ll be written in prettified JSON
Trait Implementations§
Source§impl<S: Debug + DeserializeOwned + Serialize + SparsableTrait> Debug for SparseRoot<S>
impl<S: Debug + DeserializeOwned + Serialize + SparsableTrait> Debug for SparseRoot<S>
Source§impl<S> Display for SparseRoot<S>
impl<S> Display for SparseRoot<S>
Auto Trait Implementations§
impl<S> Freeze for SparseRoot<S>where
S: Freeze,
impl<S> !RefUnwindSafe for SparseRoot<S>
impl<S> !Send for SparseRoot<S>
impl<S> !Sync for SparseRoot<S>
impl<S> Unpin for SparseRoot<S>where
S: Unpin,
impl<S> !UnwindSafe for SparseRoot<S>
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