pub struct JsonDataSource { /* private fields */ }Expand description
Shared JSON-based data source that reads version data from JSON objects.
Result: Vec<HashMap<String, Value>> in version priority order.
Implementations§
Source§impl JsonDataSource
impl JsonDataSource
Sourcepub fn from_value(data: Value, versions: &[String]) -> Result<Self, DataError>
pub fn from_value(data: Value, versions: &[String]) -> Result<Self, DataError>
Creates a JSON data source from a JSON object.
Expected format: { "VersionName": { "key1": value1, "key2": value2, ... }, ... }
Trait Implementations§
Source§impl DataSource for JsonDataSource
impl DataSource for JsonDataSource
Source§fn retrieve_single_value(&self, name: &str) -> Result<DataValue, DataError>
fn retrieve_single_value(&self, name: &str) -> Result<DataValue, DataError>
Retrieves a single numeric or boolean value.
Source§fn retrieve_1d_array_or_string(
&self,
name: &str,
) -> Result<ValueSource, DataError>
fn retrieve_1d_array_or_string( &self, name: &str, ) -> Result<ValueSource, DataError>
Retrieves a 1D array (from sheet reference) or a literal string.
Auto Trait Implementations§
impl Freeze for JsonDataSource
impl RefUnwindSafe for JsonDataSource
impl Send for JsonDataSource
impl Sync for JsonDataSource
impl Unpin for JsonDataSource
impl UnsafeUnpin for JsonDataSource
impl UnwindSafe for JsonDataSource
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