pub struct JsonTreeImporter<'a, Store, Hasher = Blake3>{ /* private fields */ }Expand description
Lossless JSON importer that preserves ordering and encodes explicit entry nodes.
This importer encodes JSON values as an explicit node/entry graph (a JSON AST), using content-addressed ids so identical subtrees deduplicate across imports.
Implementations§
Source§impl<'a, Store, Hasher> JsonTreeImporter<'a, Store, Hasher>
impl<'a, Store, Hasher> JsonTreeImporter<'a, Store, Hasher>
Sourcepub fn new(store: &'a mut Store, id_salt: Option<[u8; 32]>) -> Self
pub fn new(store: &'a mut Store, id_salt: Option<[u8; 32]>) -> Self
Creates a new lossless importer backed by store. Pass an optional
32-byte salt to namespace the content-addressed entity ids.
Sourcepub fn import_str(&mut self, input: &str) -> Result<Fragment, JsonImportError>
pub fn import_str(&mut self, input: &str) -> Result<Fragment, JsonImportError>
Imports a JSON string. Convenience wrapper around import_blob.
Sourcepub fn import_blob(
&mut self,
blob: Blob<LongString>,
) -> Result<Fragment, JsonImportError>
pub fn import_blob( &mut self, blob: Blob<LongString>, ) -> Result<Fragment, JsonImportError>
Imports a JSON document from a LongString blob, returning a
Fragment rooted at the document’s top-level node.
Auto Trait Implementations§
impl<'a, Store, Hasher> Freeze for JsonTreeImporter<'a, Store, Hasher>
impl<'a, Store, Hasher> RefUnwindSafe for JsonTreeImporter<'a, Store, Hasher>where
Store: RefUnwindSafe,
Hasher: RefUnwindSafe,
impl<'a, Store, Hasher> Send for JsonTreeImporter<'a, Store, Hasher>where
Store: Send,
impl<'a, Store, Hasher> Sync for JsonTreeImporter<'a, Store, Hasher>
impl<'a, Store, Hasher> Unpin for JsonTreeImporter<'a, Store, Hasher>where
Hasher: Unpin,
impl<'a, Store, Hasher> UnsafeUnpin for JsonTreeImporter<'a, Store, Hasher>
impl<'a, Store, Hasher = Hasher> !UnwindSafe for JsonTreeImporter<'a, Store, Hasher>
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
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