pub struct Section<'a> { /* private fields */ }Expand description
§Section Block
Available in surfaces:
A section is one of the most flexible blocks available -
it can be used as a simple text block,
in combination with text fields,
or side-by-side with any of the available block elements 🔗
Implementations§
Source§impl<'a> Section<'a>
impl<'a> Section<'a>
Sourcepub fn builder() -> SectionBuilderInit<'a>
pub fn builder() -> SectionBuilderInit<'a>
Build a new section block
For example, see blocks::section::build::SectionBuilder.
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this Section block agrees with Slack’s model requirements
§Errors
- If
fieldscontains more than 10 fields - If one of
fieldslonger than 2000 chars - If
textlonger than 3000 chars - If
block_idlonger than 255 chars
§Example
use slack_blocks::{blocks, compose::text};
let long_string = std::iter::repeat(' ').take(256).collect::<String>();
let block = blocks::Section::builder().text(text::Plain::from("file_id"))
.block_id(long_string)
.build();
assert_eq!(true, matches!(block.validate(), Err(_)));Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Section<'a>
impl<'de, 'a> Deserialize<'de> for Section<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> StructuralPartialEq for Section<'a>
Auto Trait Implementations§
impl<'a> Freeze for Section<'a>
impl<'a> RefUnwindSafe for Section<'a>
impl<'a> Send for Section<'a>
impl<'a> Sync for Section<'a>
impl<'a> Unpin for Section<'a>
impl<'a> UnwindSafe for Section<'a>
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