pub trait MicroExt {
// Required methods
fn append_micro(
&mut self,
registry: &MicroRegistry,
name: &str,
) -> Result<&mut Self, MicroError>;
fn append_micro_asset(&mut self, asset: &MicroAsset) -> &mut Self;
fn expand_micro(&mut self, registry: &MicroRegistry) -> Vec<Diagnostic>;
}Expand description
Micro assets on Text.
use rich::Text;
use rich_micro::{Layer, MicroAsset, MicroExt, MicroRegistry};
let mut registry = MicroRegistry::new();
registry.add(Layer::Inline, MicroAsset::new("ship", "rocket")?.with_emoji("🚀")?)?;
let mut text = Text::new("Deploying ");
text.append_micro(®istry, "ship")?;
assert_eq!(text.plain(), "Deploying 🚀");
assert_eq!(text.cell_len(), 12);Required Methods§
Sourcefn append_micro(
&mut self,
registry: &MicroRegistry,
name: &str,
) -> Result<&mut Self, MicroError>
fn append_micro( &mut self, registry: &MicroRegistry, name: &str, ) -> Result<&mut Self, MicroError>
Append the asset name resolves to, as its placeholder cells.
Sourcefn append_micro_asset(&mut self, asset: &MicroAsset) -> &mut Self
fn append_micro_asset(&mut self, asset: &MicroAsset) -> &mut Self
Append asset’s placeholder cells.
Sourcefn expand_micro(&mut self, registry: &MicroRegistry) -> Vec<Diagnostic>
fn expand_micro(&mut self, registry: &MicroRegistry) -> Vec<Diagnostic>
Replace the :micro:name: tokens in this text (see
markup for when to prefer the markup path).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".