Skip to main content

Markers

Struct Markers 

Source
pub struct Markers<'a> { /* private fields */ }
Expand description

The markers of one level, in one workspace.

Implementations§

Source§

impl<'a> Markers<'a>

Source

pub fn new(workspace: &'a Path, level: LevelId) -> Self

Markers of level in workspace.

Source

pub fn level(&self) -> LevelId

The level these markers belong to.

Source

pub fn path(&self, marker: &Marker) -> PathBuf

Where the marker lives.

Source

pub fn exists(&self, marker: &Marker) -> bool

True when the marker file exists.

Source

pub fn create(&self, marker: &Marker) -> Result<()>

Create the marker (empty), creating the workspace if it is missing.

Source

pub fn create_with(&self, marker: &Marker, content: &str) -> Result<()>

Create the marker with the given content, replacing any previous content. A marker path that is a symlink is refused rather than written through (O_NOFOLLOW), so a link in the workspace can never make the game overwrite another file; preparing the level removes the link itself.

Source

pub fn read(&self, marker: &Marker) -> Option<String>

The marker’s content, or None when it does not exist or cannot be read.

Source

pub fn remove(&self, marker: &Marker) -> Result<()>

Delete the marker. A marker that is already gone is not an error.

Trait Implementations§

Source§

impl<'a> Clone for Markers<'a>

Source§

fn clone(&self) -> Markers<'a>

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<'a> Copy for Markers<'a>

Source§

impl<'a> Debug for Markers<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Markers<'a>

§

impl<'a> RefUnwindSafe for Markers<'a>

§

impl<'a> Send for Markers<'a>

§

impl<'a> Sync for Markers<'a>

§

impl<'a> Unpin for Markers<'a>

§

impl<'a> UnsafeUnpin for Markers<'a>

§

impl<'a> UnwindSafe for Markers<'a>

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