Skip to main content

Files

Struct Files 

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

Policy layers, each read from a path.

A layer with no path, or whose path is not there, says nothing.

Implementations§

Source§

impl Files

Source

pub fn none() -> Self

Nothing anywhere. Layers are added with at.

Source

pub fn at(self, origin: Origin, path: impl Into<PathBuf>) -> Self

Read this layer from this path.

Source

pub fn locations(&self) -> impl DoubleEndedIterator<Item = (Origin, &Path)>

Where each layer is looked for, highest authority first.

For an interface that reports the file it is actually reading rather than the one the documentation names. Every path here comes out of the environment — XDG_CONFIG_HOME on this platform, and the equivalents elsewhere — so where a person’s settings live and where they live by default are two questions, and only the running program can answer the first.

A layer being listed says nothing about the file being there. Ask Source::layer for that, which reads it.

Source

pub fn for_this_platform() -> Self

The layers this platform keeps in files, at the places concept 10 names.

Linux and macOS, and the same two places on both: a root-owned /etc/slipcase taking precedence over the user’s own configuration under $XDG_CONFIG_HOME. macOS has /etc and keeps it root-owned the same way, and the XDG path for the user’s file is the family’s precedent there — slipcase-desktop keeps its state under the XDG directories on macOS — which is also what lets tests/the_process.rs hold both platforms to one answer. Sessions are the exception and session::platform_base says why.

There is no per-user policy layer on either, because neither has a mechanism in files that would administer one — Origin::UserPolicy is Windows vocabulary, and the configuration profile concept 10 names for macOS is not built. Inventing a file for it would be offering an administrator a control that nothing enforces.

Windows gets nothing from this and reads its policy from the registry. The Linux filenames are confirmed against the package that installs them; on macOS nothing installs them and packaging/macos/README.md says what an administrator writes by hand.

Trait Implementations§

Source§

impl Clone for Files

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 Files

Source§

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

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

impl Default for Files

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Source for Files

Source§

fn layer(&self, origin: Origin) -> Read

This layer, read now rather than remembered. An implementation that caches is the bypass concept 10 warns about. Read more

Auto Trait Implementations§

§

impl Freeze for Files

§

impl RefUnwindSafe for Files

§

impl Send for Files

§

impl Sync for Files

§

impl Unpin for Files

§

impl UnsafeUnpin for Files

§

impl UnwindSafe for Files

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more