Struct InMemoryMetadataStore

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

In‑memory implementation of MetadataStore backed by a HashMap.

What: Holds metadata in a hash map where the key is the file path.

How: Provides a new constructor and implements the MetadataStore trait methods by delegating to the underlying map.

Why: Offers a zero‑cost, dependency‑free store suitable for unit tests and simple scenarios. It can be replaced with a persistent store without changing callers.

Implementations§

Source§

impl InMemoryMetadataStore

Source

pub fn new() -> Self

Creates a fresh, empty InMemoryMetadataStore.

What: Returns a struct with an empty internal map.

How: Calls HashMap::new.

Why: Convenience constructor for callers.

Trait Implementations§

Source§

impl MetadataStore for InMemoryMetadataStore

Source§

fn get(&self, path: &str) -> Option<&String>

Retrieves the metadata for path if it exists.
Source§

fn set(&mut self, path: &str, metadata: String)

Stores metadata for path, overwriting any existing value.
Source§

fn remove(&mut self, path: &str) -> Option<String>

Removes the metadata entry for path, returning the old value if any.

Auto Trait Implementations§

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> 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, 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.