Skip to main content

AppRoot

Struct AppRoot 

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

<Orthic Labs>/<App>, created private.

Implementations§

Source§

impl AppRoot

Source

pub fn new(suite: &Suite, app: &str) -> Result<AppRoot, AppRootError>

Source

pub fn name(&self) -> &str

Source

pub fn root(&self) -> &Path

Source

pub fn path(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>

<app root>/<rel> without creating anything. rel must be relative and made only of normal components (no .., ., root, prefix or empty); any existing ancestor that is a symlink must still resolve inside the app root.

Source

pub fn data_dir(&self, rel: impl AsRef<Path>) -> Result<PathBuf, AppRootError>

A private directory at <app root>/<rel>, created if absent.

Source

pub fn lock_writer(&self) -> Result<WriterLock, AppRootError>

Take the single-writer lock for this app root. Err(WriterBusy) if another holder lives.

Source

pub fn migrate_from(&self, src: &Path) -> Result<MigrationOutcome, AppRootError>

Copy the old root src into this app root, verify every byte, then commit an atomic marker. Restart-safe: files land under a temporary name and are renamed only when fully written; a rerun after any interruption re-copies missing or partial files, accepts files already identical, and refuses (never overwrites) a differing destination file. The marker is written last; once present for this source the call is a no-op. src is never changed or deleted. Symlinks and special files in src are refused. Takes the writer lock.

Trait Implementations§

Source§

impl Clone for AppRoot

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AppRoot

Source§

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

Formats the value using the given formatter. Read more

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

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.