Skip to main content

Files

Struct Files 

Source
pub struct Files { /* private fields */ }

Implementations§

Source§

impl Files

Source

pub fn new(user: Option<PathBuf>, host: PathBuf, sessions: PathBuf) -> Files

user: the user scope’s directory (<config dir>/memory), if there is a config directory. host: this host’s directory. sessions: where each session’s directory is made.

Source

pub fn project_root(cwd: &Path) -> PathBuf

The project a working directory belongs to: see crate::project_root.

Source

pub fn dir(&self, cx: &Context, scope: Scope) -> Result<PathBuf, Error>

The directory that holds scope’s memories for cx.

Trait Implementations§

Source§

impl Debug for Files

Source§

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

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

impl Provider for Files

Source§

fn name(&self) -> &'static str

The settings name: files, sqlite, or kosmonaut.
Source§

fn remember(&self, cx: &Context, new: New) -> Result<Memory, Error>

Source§

fn list( &self, cx: &Context, scope: Option<Scope>, kind: Option<Kind>, ) -> Result<Found, Error>

Newest first.
Source§

fn get(&self, cx: &Context, id: &str) -> Result<Memory, Error>

Source§

fn update( &self, cx: &Context, id: &str, change: Change, ) -> Result<Memory, Error>

Source§

fn put(&self, cx: &Context, m: &Memory) -> Result<Memory, Error>

Keep m as it is, under its id and with its times, replacing a memory with the same id: how memories move between providers (transfer). m.path and m.score are ignored.
Source§

fn forget(&self, cx: &Context, id: &str) -> Result<Memory, Error>

Remove a memory; returns what was removed.
Source§

fn recall( &self, cx: &Context, query: &str, scope: Option<Scope>, limit: Option<usize>, ) -> Result<Found, Error>

Memories matching query, best first; at most limit (DEFAULT_LIMIT when None, never more than MAX_LIMIT).

Auto Trait Implementations§

§

impl !Freeze for Files

§

impl Forget for Files

§

impl Move for Files

§

impl RefUnwindSafe for Files

§

impl Send for Files
where RawVecInner: Send, Mutex<()>: Send,

§

impl Sync for Files
where RawVecInner: Sync, Mutex<()>: Sync,

§

impl Unpin for Files
where *const u8 is !null: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin,

§

impl UnsafeUnpin for Files
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin,

§

impl UnwindSafe for Files
where RawVecInner: UnwindSafe, Mutex<()>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.