pub struct LoroMap { /* private fields */ }Implementations§
Source§impl LoroMap
impl LoroMap
pub fn new() -> Self
pub fn is_attached(&self) -> bool
Sourcepub fn get_attached(&self) -> Option<Arc<LoroMap>>
pub fn get_attached(&self) -> Option<Arc<LoroMap>>
If a detached container is attached, this method will return its corresponding attached handler.
Sourcepub fn delete(&self, key: &str) -> LoroResult<()>
pub fn delete(&self, key: &str) -> LoroResult<()>
Delete a key-value pair from the map.
Sourcepub fn insert(&self, key: &str, value: Arc<dyn LoroValueLike>) -> LoroResult<()>
pub fn insert(&self, key: &str, value: Arc<dyn LoroValueLike>) -> LoroResult<()>
Iterate over the key-value pairs of the map. Insert a key-value pair into the map.
Sourcepub fn id(&self) -> ContainerID
pub fn id(&self) -> ContainerID
Get the ID of the map.
Sourcepub fn get(&self, key: &str) -> Option<Arc<dyn ValueOrContainer>>
pub fn get(&self, key: &str) -> Option<Arc<dyn ValueOrContainer>>
Get the value of the map with the given key.
pub fn get_or_create_text_container( &self, key: &str, text: Arc<LoroText>, ) -> LoroResult<Arc<LoroText>>
pub fn get_or_create_map_container( &self, key: &str, map: Arc<LoroMap>, ) -> LoroResult<Arc<LoroMap>>
pub fn get_or_create_tree_container( &self, key: &str, tree: Arc<LoroTree>, ) -> LoroResult<Arc<LoroTree>>
pub fn get_or_create_list_container( &self, key: &str, list: Arc<LoroList>, ) -> LoroResult<Arc<LoroList>>
pub fn get_or_create_movable_list_container( &self, key: &str, list: Arc<LoroMovableList>, ) -> LoroResult<Arc<LoroMovableList>>
pub fn get_or_create_counter_container( &self, key: &str, counter: Arc<LoroCounter>, ) -> LoroResult<Arc<LoroCounter>>
pub fn insert_list_container( &self, key: &str, child: Arc<LoroList>, ) -> LoroResult<Arc<LoroList>>
pub fn insert_map_container( &self, key: &str, child: Arc<LoroMap>, ) -> LoroResult<Arc<LoroMap>>
pub fn insert_text_container( &self, key: &str, child: Arc<LoroText>, ) -> LoroResult<Arc<LoroText>>
pub fn insert_tree_container( &self, key: &str, child: Arc<LoroTree>, ) -> LoroResult<Arc<LoroTree>>
pub fn insert_movable_list_container( &self, key: &str, child: Arc<LoroMovableList>, ) -> LoroResult<Arc<LoroMovableList>>
pub fn insert_counter_container( &self, key: &str, child: Arc<LoroCounter>, ) -> LoroResult<Arc<LoroCounter>>
Sourcepub fn get_value(&self) -> LoroValue
pub fn get_value(&self) -> LoroValue
Get the shallow value of the map.
It will not convert the state of sub-containers, but represent them as LoroValue::Container.
Sourcepub fn get_deep_value(&self) -> LoroValue
pub fn get_deep_value(&self) -> LoroValue
Get the deep value of the map.
It will convert the state of sub-containers into a nested JSON value.
pub fn is_deleted(&self) -> bool
pub fn get_last_editor(&self, key: &str) -> Option<PeerID>
pub fn clear(&self) -> LoroResult<()>
pub fn keys(&self) -> Vec<String>
pub fn values(&self) -> Vec<Arc<dyn ValueOrContainer>>
pub fn doc(&self) -> Option<Arc<LoroDoc>>
pub fn subscribe( &self, subscriber: Arc<dyn Subscriber>, ) -> Option<Arc<Subscription>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LoroMap
impl RefUnwindSafe for LoroMap
impl Send for LoroMap
impl Sync for LoroMap
impl Unpin for LoroMap
impl UnwindSafe for LoroMap
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, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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>
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);