pub struct RichExtensionBlock {
pub renderer: String,
pub title: String,
pub summary: Option<String>,
pub body: String,
pub status: RichDocumentStatus,
pub initially_expanded: bool,
pub metadata: Vec<(String, String)>,
}Expand description
Application-defined structured block rendered through a registry entry.
renderer is an architecture-neutral dispatch key such as tool-call,
diff, or operation-log. The fallback renderer remains usable when an
application does not register a specialized widget.
Fields§
§renderer: String§title: String§summary: Option<String>§body: String§status: RichDocumentStatus§initially_expanded: bool§metadata: Vec<(String, String)>Implementations§
Source§impl RichExtensionBlock
impl RichExtensionBlock
Sourcepub fn new(
renderer: impl Into<String>,
title: impl Into<String>,
) -> RichExtensionBlock
pub fn new( renderer: impl Into<String>, title: impl Into<String>, ) -> RichExtensionBlock
Examples found in repository?
examples/rich_document.rs (line 21)
3fn main() -> Result<()> {
4 let theme = DefaultTheme::dark();
5 let document = RichDocumentModel::from_markdown(
6 r#"# Deployment report
7
8SUI keeps this document selectable across blocks. Follow the [runbook](https://example.test/runbook) for details.
9
10- [x] Build artifacts
11- [x] Run tests
12- [ ] Publish release
13
14```rust
15let status = deploy().await?;
16assert!(status.ready());
17```
18"#,
19 );
20
21 let mut operation = RichExtensionBlock::new("operation-log", "Release operation");
22 operation.status = RichDocumentStatus::Running;
23 operation.summary = Some("2 of 3 stages complete".into());
24 operation.body = "build complete\ntest complete\npublish running".into();
25 document.append_extension(operation);
26
27 let view = RichDocumentView::new(document)
28 .theme(theme)
29 .on_link(|destination| println!("Application URL policy received: {destination}"));
30 let root = Surface::window(ScrollView::vertical(view).retain_content_layer())
31 .theme(theme)
32 .padding(Insets::all(24.0))
33 .fill();
34
35 App::new()
36 .window(Window::new("SUI Rich Document").root(root))
37 .run()
38}Trait Implementations§
Source§impl Clone for RichExtensionBlock
impl Clone for RichExtensionBlock
Source§fn clone(&self) -> RichExtensionBlock
fn clone(&self) -> RichExtensionBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RichExtensionBlock
impl Debug for RichExtensionBlock
impl Eq for RichExtensionBlock
Source§impl PartialEq for RichExtensionBlock
impl PartialEq for RichExtensionBlock
impl StructuralPartialEq for RichExtensionBlock
Auto Trait Implementations§
impl Freeze for RichExtensionBlock
impl RefUnwindSafe for RichExtensionBlock
impl Send for RichExtensionBlock
impl Sync for RichExtensionBlock
impl Unpin for RichExtensionBlock
impl UnsafeUnpin for RichExtensionBlock
impl UnwindSafe for RichExtensionBlock
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.