[][src]Struct libimagstore::store::Entry

pub struct Entry { /* fields omitted */ }

An Entry of the store Contains location, header and content part.

Methods

impl Entry[src]

pub fn new(loc: StoreId) -> Entry[src]

Create a new store entry with its location at loc.

This creates the entry with the default header from Entry::default_header() and an empty content.

pub fn default_header() -> Value[src]

Get the default Header for an Entry.

This function should be used to get a new Header, as the default header may change. Via this function, compatibility is ensured.

pub fn from_reader<S: IntoStoreId>(loc: S, file: &mut dyn Read) -> Result<Entry>[src]

See Entry::from_str(), as this function is used internally. This is just a wrapper for convenience.

pub fn from_str<S: IntoStoreId>(loc: S, s: &str) -> Result<Entry>[src]

Create a new Entry, with contents from the string passed.

The passed string must be a complete valid store entry, including header. So this is probably not what end-users want to call.

Return value

This errors if

  • String cannot be matched on regex to find header and content
  • Header cannot be parsed into a TOML object

pub fn to_str(&self) -> Result<String>[src]

Return the string representation of this entry

This means not only the content of the entry, but the complete entry (from memory, not from disk).

pub fn get_location(&self) -> &StoreId[src]

Get the location of the Entry

pub fn get_header(&self) -> &Value[src]

Get the header of the Entry

pub fn get_header_mut(&mut self) -> &mut Value[src]

Get the header mutably of the Entry

pub fn get_content(&self) -> &EntryContent[src]

Get the content of the Entry

pub fn set_content(&mut self, content: EntryContent)[src]

Set the content of the Entry

pub fn get_content_mut(&mut self) -> &mut EntryContent[src]

Get the content mutably of the Entry

pub fn replace_from_buffer(&mut self, buf: &str) -> Result<()>[src]

Replace both header and content of the entry by reading from buffer

If an error is returned, the contents of neither the header nor the content are modified.

pub fn verify(&self) -> Result<()>[src]

Verify the entry.

Currently, this only verifies the header. This might change in the future.

Trait Implementations

impl Clone for Entry[src]

impl Debug for Entry[src]

impl PartialEq<Entry> for Entry[src]

Auto Trait Implementations

impl RefUnwindSafe for Entry

impl Send for Entry

impl Sync for Entry

impl Unpin for Entry

impl UnwindSafe for Entry

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,