pub struct Document {
pub blocks: Vec<Block>,
}Expand description
A normalized rich message document: an ordered list of top-level blocks.
Fields§
§blocks: Vec<Block>Top-level blocks of the document.
Implementations§
Source§impl Document
impl Document
Sourcepub fn fit(&mut self, opts: &FitOptions) -> bool
pub fn fit(&mut self, opts: &FitOptions) -> bool
Fits the document into opts.limits and appends opts.tail.
The following adjustments are applied in order:
- Table rows wider than
max_table_columnslose their extra cells. - Media beyond
max_mediaare replaced by plain links. - Formatting and containers nested deeper than
max_depthare unwrapped / flattened. - If characters or blocks still exceed the limits, the content is cut
at the last block that fits (descending into lists, quotes, details
and tables, and cutting text blocks mid-text if needed), and
opts.truncation_noticeis appended.
Returns true if content was truncated in step 4.
Source§impl Document
impl Document
Sourcepub fn to_html(&self) -> String
pub fn to_html(&self) -> String
Renders the document to Telegram Rich HTML, suitable for
InputRichMessage::html.
Sourcepub fn to_input_rich_message(&self) -> InputRichMessage
pub fn to_input_rich_message(&self) -> InputRichMessage
Renders the document and wraps it into an InputRichMessage.
Trait Implementations§
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Document
impl Move for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
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