pub struct Store {
pub base_domain: Arc<Mutex<Option<String>>>,
/* private fields */
}Expand description
The in-memory store of data, containing the Resources, Properties and Classes
It uses the default_agent as the default client.
Fields§
§base_domain: Arc<Mutex<Option<String>>>The base domain of the store
Implementations§
Source§impl Store
impl Store
Sourcepub async fn init() -> AtomicResult<Store>
pub async fn init() -> AtomicResult<Store>
Creates an empty Store.
Run .populate() to get useful standard models loaded into your store.
Sourcepub fn set_base_url(&self, url: &str)
pub fn set_base_url(&self, url: &str)
Sets the base URL of the store.
Trait Implementations§
Source§impl Storelike for Store
impl Storelike for Store
Source§fn add_atoms<'life0, 'async_trait>(
&'life0 self,
atoms: Vec<Atom>,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_atoms<'life0, 'async_trait>(
&'life0 self,
atoms: Vec<Atom>,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The atoms abstraction has been deprecated in favor of Resources
Source§fn add_drive_mapping(&self, host: &str, drive_did: &Value) -> AtomicResult<()>
fn add_drive_mapping(&self, host: &str, drive_did: &Value) -> AtomicResult<()>
Source§fn remove_drive_mapping(&self, host: &str) -> AtomicResult<()>
fn remove_drive_mapping(&self, host: &str) -> AtomicResult<()>
Source§fn get_base_domain(&self) -> Option<String>
fn get_base_domain(&self) -> Option<String>
Source§fn set_base_url(&self, url: &str)
fn set_base_url(&self, url: &str)
Source§fn add_resource_opts<'life0, 'life1, 'async_trait>(
&'life0 self,
resource: &'life1 Resource,
check_required_props: bool,
update_index: bool,
overwrite_existing: bool,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_resource_opts<'life0, 'life1, 'async_trait>(
&'life0 self,
resource: &'life1 Resource,
check_required_props: bool,
update_index: bool,
overwrite_existing: bool,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn all_resources(
&self,
_include_external: bool,
) -> Box<dyn Iterator<Item = Resource> + Send>
fn all_resources( &self, _include_external: bool, ) -> Box<dyn Iterator<Item = Resource> + Send>
self URL of the store.Source§fn get_default_agent(&self) -> AtomicResult<Agent>
fn get_default_agent(&self) -> AtomicResult<Agent>
Source§fn get_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
get_resource_extended.
Returns a full Resource with native Values.
Note that this does not construct dynamic Resources, such as collections.
If you’re not sure what to use, use get_resource_extended.Source§fn has_stored_resource(&self, subject: &Subject) -> bool
fn has_stored_resource(&self, subject: &Subject) -> bool
Source§fn remove_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn set_default_agent(&self, agent: Agent)
fn set_default_agent(&self, agent: Agent)
Source§fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
q: &'life1 Query,
) -> Pin<Box<dyn Future<Output = AtomicResult<QueryResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
q: &'life1 Query,
) -> Pin<Box<dyn Future<Output = AtomicResult<QueryResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_server_url(&self) -> String
fn get_server_url(&self) -> String
Source§fn sync_policy(&self) -> Arc<dyn SyncPolicy> ⓘ
fn sync_policy(&self) -> Arc<dyn SyncPolicy> ⓘ
crate::sync::policy::OpenPolicy (self-hosted / local-first,
and every non-Db store). A managed node’s Db returns the policy
installed via Db::set_sync_policy, which the commit / sync paths consult
to gate writes to un-enrolled drives.Source§fn get_active_drive(&self) -> Option<String>
fn get_active_drive(&self) -> Option<String>
Source§fn clear_tombstone(&self, _subject: &str)
fn clear_tombstone(&self, _subject: &str)
subject — see
[crate::sync::tombstones::clear_tombstone] (F11,
planning/unified-sync.md): a subject that legitimately passes a
rights-checked genesis again after being destroyed must not keep
being invisible to future bulk sync. No-op default for stores with
no tombstone concept (test doubles, non-Db stores); Db overrides
this to call the real KV-backed implementation.Source§fn set_active_drive(&self, _drive: &str) -> AtomicResult<()>
fn set_active_drive(&self, _drive: &str) -> AtomicResult<()>
Source§fn clear_default_agent(&self)
fn clear_default_agent(&self)
fn normalize_subject(&self, subject: &Subject) -> Subject
Source§fn add_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
resource: &'life1 Resource,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
resource: &'life1 Resource,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
resource.save() instead, which uses Commits.Source§fn apply_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
commit: Commit,
opts: &'life1 CommitOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<CommitResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn apply_commit<'life0, 'life1, 'async_trait>(
&'life0 self,
commit: Commit,
opts: &'life1 CommitOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<CommitResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_value<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 str,
property: &'life2 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_value<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 str,
property: &'life2 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn create_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
name: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = AtomicResult<Agent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
name: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = AtomicResult<Agent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
agent.to_resource().save_locally().Source§fn export(&self, include_external: bool) -> AtomicResult<String>
fn export(&self, include_external: bool) -> AtomicResult<String>
Source§fn fetch_resource<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 str,
client_agent: Option<&'life2 Agent>,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_resource<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 str,
client_agent: Option<&'life2 Agent>,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
client_agent for Authentication.Source§fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
opts: SearchOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<Vec<Resource>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
opts: SearchOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<Vec<Resource>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_defaults_fingerprint(&self) -> AtomicResult<Option<String>>
fn get_defaults_fingerprint(&self) -> AtomicResult<Option<String>>
lib/defaults/*.json + base
models) that were last seeded into this store, if the store persists
one. See crate::populate::bootstrap. Stores that do not persist it
return None, which makes every open re-run the (idempotent) seed.Source§fn set_defaults_fingerprint(&self, _fingerprint: &str) -> AtomicResult<()>
fn set_defaults_fingerprint(&self, _fingerprint: &str) -> AtomicResult<()>
Source§fn get_resource_new<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = Resource> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_resource_new<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = Resource> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_class<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Class>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_class<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Class>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_classes_for_subject<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<Vec<Class>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_classes_for_subject<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
) -> Pin<Box<dyn Future<Output = AtomicResult<Vec<Class>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_property<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Property>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_property<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = AtomicResult<Property>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_resource_extended<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
skip_dynamic: bool,
for_agent: &'life2 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<ResourceResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_resource_extended<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 Subject,
skip_dynamic: bool,
for_agent: &'life2 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<ResourceResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
for_agent is None, no authorization checks will be done, and all resources will return.
If you want public only resurces, pass Some(crate::authentication::public_agent) as the agent. Read moreSource§fn handle_commit(&self, _commit_response: &CommitResponse)
fn handle_commit(&self, _commit_response: &CommitResponse)
fn handle_not_found<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
subject: &'life1 str,
_error: AtomicError,
for_agent: Option<&'life2 Agent>,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn import<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
string: &'life1 str,
parse_opts: &'life2 ParseOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn import<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
string: &'life1 str,
parse_opts: &'life2 ParseOpts,
) -> Pin<Box<dyn Future<Output = AtomicResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn get_path<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
atomic_path: &'life1 str,
mapping: Option<&'life2 Mapping>,
for_agent: &'life3 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<PathReturn>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_path<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
atomic_path: &'life1 str,
mapping: Option<&'life2 Mapping>,
for_agent: &'life3 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<PathReturn>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
https://example.com description or thing isa 0
https://docs.atomicdata.dev/core/paths.html
The for_agent argument is used to check if the user has rights to the resource.
You can pass None if you don’t care about the rights (e.g. in client side apps)
If you want to perform read rights checks, pass Some for_agent subjectSource§fn post_resource<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_subject: &'life1 str,
_body: Vec<u8>,
_for_agent: &'life2 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn post_resource<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_subject: &'life1 str,
_body: Vec<u8>,
_for_agent: &'life2 ForAgent,
) -> Pin<Box<dyn Future<Output = AtomicResult<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn populate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn populate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AtomicResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn validate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ValidationReport> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ValidationReport> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn begin_batch(&self)
fn begin_batch(&self)
Source§fn commit_batch(&self) -> AtomicResult<()>
fn commit_batch(&self) -> AtomicResult<()>
Auto Trait Implementations§
impl Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
impl UnwindSafe for Store
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);