pub struct Layers { /* private fields */ }Expand description
The layers above app, by path.
Implementations§
Source§impl Layers
impl Layers
pub fn new() -> Layers
Sourcepub fn declare(&mut self, scope: ValueScope)
pub fn declare(&mut self, scope: ValueScope)
Declares a host scope above those declared before it (it wins over
them); declaring it again changes nothing. app and run are not
declared.
Sourcepub fn declared(&self) -> &[ValueScope]
pub fn declared(&self) -> &[ValueScope]
The host’s scopes, lowest first.
Sourcepub fn stack(&self) -> Vec<ValueScope>
pub fn stack(&self) -> Vec<ValueScope>
Every scope, lowest first: app, the host’s, run.
Sourcepub fn offer(&mut self, scope: ValueScope, on: bool)
pub fn offer(&mut self, scope: ValueScope, on: bool)
Offers a host scope for editing (the application opened its library, its workspace…), or takes it back. A scope not declared yet is declared, above the others.
Sourcepub fn offered(&self) -> &[ValueScope]
pub fn offered(&self) -> &[ValueScope]
The editable layers open, lowest first.
Sourcepub fn origin(&self, path: &str) -> ValueScope
pub fn origin(&self, path: &str) -> ValueScope
The layer the effective value comes from: the highest holding the
path, else app.
Sourcepub fn holders(
&self,
path: &str,
store: &Value,
default: &Value,
) -> Vec<ValueScope>
pub fn holders( &self, path: &str, store: &Value, default: &Value, ) -> Vec<ValueScope>
The scopes holding a value for the path, lowest first (app when
it differs from the default, as store and default say).
Sourcepub fn value_in(
&self,
scope: ValueScope,
path: &str,
store: &Value,
) -> Option<Value>
pub fn value_in( &self, scope: ValueScope, path: &str, store: &Value, ) -> Option<Value>
A layer’s own value for the path; app’s is the store’s unless a
layer above holds the path.
Sourcepub fn app_value(&self, path: &str, store: &Value) -> Value
pub fn app_value(&self, path: &str, store: &Value) -> Value
The app value: the one kept aside, else the store’s.
Sourcepub fn set(
&mut self,
scope: ValueScope,
path: &str,
value: Value,
store: &Value,
) -> Option<Value>
pub fn set( &mut self, scope: ValueScope, path: &str, value: Value, store: &Value, ) -> Option<Value>
Sets a value in a layer. store is the store’s value now. Returns
the effective value when it changes (the caller writes it).
None for run (set with Layers::set_run).
Sourcepub fn set_run(
&mut self,
path: &str,
value: Value,
store: &Value,
) -> Option<Value>
pub fn set_run( &mut self, path: &str, value: Value, store: &Value, ) -> Option<Value>
The command line’s override of a path.
Sourcepub fn clear(
&mut self,
scope: ValueScope,
path: &str,
store: &Value,
default: &Value,
) -> Option<Value>
pub fn clear( &mut self, scope: ValueScope, path: &str, store: &Value, default: &Value, ) -> Option<Value>
Takes a layer’s value back (its reset): app goes back to the
default. Returns the effective value when it changes.
Sourcepub fn export(&self, scope: ValueScope) -> BTreeMap<String, Value>
pub fn export(&self, scope: ValueScope) -> BTreeMap<String, Value>
A layer’s values (what the application saves with its library or workspace).
Sourcepub fn load(
&mut self,
scope: ValueScope,
values: BTreeMap<String, Value>,
store: &dyn Fn(&str) -> Option<Value>,
) -> Vec<(String, Value)>
pub fn load( &mut self, scope: ValueScope, values: BTreeMap<String, Value>, store: &dyn Fn(&str) -> Option<Value>, ) -> Vec<(String, Value)>
Replaces a layer’s values (a library or workspace opened, or
closed with an empty map). store reads the store’s value of a
path. Returns the effective values to write.
Trait Implementations§
Source§impl Serialize for Layers
impl Serialize for Layers
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Layers
Auto Trait Implementations§
impl Freeze for Layers
impl RefUnwindSafe for Layers
impl Send for Layers
impl Sync for Layers
impl Unpin for Layers
impl UnsafeUnpin for Layers
impl UnwindSafe for Layers
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more