Json

Struct Json 

Source
pub struct Json { /* private fields */ }
Expand description

JSON backend

All data is saved in JSON files inside json_folder. The session information is stored directly there with its runs id as filename. This id is also used to create a subfolder where all datasets are stored. For those, the id is used as a filename.

A folder with one session and five datasets could look like this:

9F03105D9451CC3A.json
9F03105D9451CC3A
9F03105D9451CC3A/96ae94e6-cc1a-4621-999c-32a72741e4e8.json
9F03105D9451CC3A/4eac9469-09a4-484c-a7cd-b1aa37d91a6c.json
9F03105D9451CC3A/b9b446a3-78a9-4fe5-b4c1-530759e33282.json
9F03105D9451CC3A/a33a95e6-afd7-4cdf-8e66-54180a77312f.json
9F03105D9451CC3A/c04a2a79-7b13-413f-8f35-523259937101.json

Implementations§

Source§

impl Json

Source

pub fn new<P: Into<PathBuf>>(json_folder: P) -> Self

Create new JSON backend

§Arguments
  • json_folder folder that will contain all JSON files
Source§

impl Json

Trait Implementations§

Source§

impl Clone for Json

Source§

fn clone(&self) -> Json

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Database for Json

Source§

type Error = Error

Source§

fn add_session( &mut self, session: Session, ) -> Result<Box<dyn DatabaseSession<Error = Self::Error>>>

Add a session to the database
Source§

fn get_sessions( &self, ) -> Result<Vec<Box<dyn DatabaseSession<Error = Self::Error>>>>

Get an interation over sessions in the database
Source§

fn remove_session(&mut self, _session: Session) -> Result<()>

Add a session to the database
Source§

impl Debug for Json

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Json

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Json

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Json

§

impl RefUnwindSafe for Json

§

impl Send for Json

§

impl Sync for Json

§

impl Unpin for Json

§

impl UnwindSafe for Json

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,