pub struct JsonFormatAdapter { /* private fields */ }Expand description
A FormatAdapter that parses a JSON array of objects.
Entities and edges may be mixed in the same array — the adapter dispatches
by checking for source + target keys (edge) vs. their absence (entity).
Construct with JsonFormatAdapter::new, passing the raw JSON bytes.
The constructor parses eagerly; iteration is cheap once constructed.
Implementations§
Source§impl JsonFormatAdapter
impl JsonFormatAdapter
Sourcepub fn new(json_input: &str) -> Result<Self, AdapterError>
pub fn new(json_input: &str) -> Result<Self, AdapterError>
Parse json_input and return a ready adapter.
Returns Err(AdapterError::Parse) if json_input is not valid JSON or
is not a JSON array at the top level.
Trait Implementations§
Source§impl FormatAdapter for JsonFormatAdapter
impl FormatAdapter for JsonFormatAdapter
Source§fn entities(
&mut self,
) -> impl Iterator<Item = Result<EntityRecord, AdapterError>>
fn entities( &mut self, ) -> impl Iterator<Item = Result<EntityRecord, AdapterError>>
Iterate over entity records in the source.
Source§fn edges(&mut self) -> impl Iterator<Item = Result<EdgeRecord, AdapterError>>
fn edges(&mut self) -> impl Iterator<Item = Result<EdgeRecord, AdapterError>>
Iterate over edge records in the source.
Auto Trait Implementations§
impl Freeze for JsonFormatAdapter
impl RefUnwindSafe for JsonFormatAdapter
impl Send for JsonFormatAdapter
impl Sync for JsonFormatAdapter
impl Unpin for JsonFormatAdapter
impl UnsafeUnpin for JsonFormatAdapter
impl UnwindSafe for JsonFormatAdapter
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