pub struct Block { /* private fields */ }Expand description
A builder for creating message blocks.
§Examples
use seabird::Block;
// Simple text with formatting
let block = Block::new()
.text("Hello ")
.bold("world")
.text("!");
// Nested formatting
let block = Block::new()
.text("This is ")
.bold(Block::new().italic("very").text(" important"));
// Lists
let block = Block::new()
.text("My list:")
.list(vec!["Item 1", "Item 2", "Item 3"]);
// Combining blocks with append/prepend
let header = Block::new().heading(1, "Title");
let body = Block::new().text("Content");
let block = Block::new()
.append(header)
.append(body);Implementations§
Source§impl Block
impl Block
Sourcepub fn append(self, block: impl Into<Block>) -> Self
pub fn append(self, block: impl Into<Block>) -> Self
Appends blocks from another Block or proto::Block to the end.
Sourcepub fn prepend(self, block: impl Into<Block>) -> Self
pub fn prepend(self, block: impl Into<Block>) -> Self
Prepends blocks from another Block or proto::Block to the beginning.
Sourcepub fn strikethrough(self, content: impl Into<Block>) -> Self
pub fn strikethrough(self, content: impl Into<Block>) -> Self
Adds a strikethrough-formatted block.
Sourcepub fn blockquote(self, content: impl Into<Block>) -> Self
pub fn blockquote(self, content: impl Into<Block>) -> Self
Adds a blockquote-formatted block.
Sourcepub fn inline_code(self, text: impl Into<String>) -> Self
pub fn inline_code(self, text: impl Into<String>) -> Self
Adds an inline code block.
Sourcepub fn fenced_code(
self,
info: impl Into<String>,
text: impl Into<String>,
) -> Self
pub fn fenced_code( self, info: impl Into<String>, text: impl Into<String>, ) -> Self
Adds a fenced code block with optional language info.
Sourcepub fn link(self, url: impl Into<String>, content: impl Into<Block>) -> Self
pub fn link(self, url: impl Into<String>, content: impl Into<Block>) -> Self
Adds a link block with a URL and content.
Sourcepub fn heading(self, level: i32, content: impl Into<Block>) -> Self
pub fn heading(self, level: i32, content: impl Into<Block>) -> Self
Adds a heading block with a level and content.
Sourcepub fn list(self, items: impl IntoIterator<Item = impl Into<Block>>) -> Self
pub fn list(self, items: impl IntoIterator<Item = impl Into<Block>>) -> Self
Adds a list block containing multiple items.
Sourcepub fn timestamp(self, time: SystemTime) -> Self
pub fn timestamp(self, time: SystemTime) -> Self
Adds a timestamp block.
Sourcepub fn container(
self,
blocks: impl IntoIterator<Item = impl Into<Block>>,
) -> Self
pub fn container( self, blocks: impl IntoIterator<Item = impl Into<Block>>, ) -> Self
Adds a container block with multiple child blocks.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnsafeUnpin for Block
impl UnwindSafe for Block
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request