pub struct Context<'a> { /* private fields */ }Expand description
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn builder() -> ContextBuilderInit<'a>
pub fn builder() -> ContextBuilderInit<'a>
Build a new Context block.
For example, see docs for ContextBuilder.
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this Context block agrees with Slack’s model requirements
§Errors
- If
block_idlonger than 255 chars - If
elementscontains more than 10 objects
§Example
use slack_blocks::{blocks::Context, text::ToSlackPlaintext};
let long_string = std::iter::repeat(' ').take(256).collect::<String>();
let block = Context::builder().element("foo".plaintext())
.block_id(long_string)
.build();
assert_eq!(true, matches!(block.validate(), Err(_)));Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Context<'a>
impl<'de, 'a> Deserialize<'de> for Context<'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
Source§impl<'a> From<Vec<ImageOrText<'a>>> for Context<'a>
impl<'a> From<Vec<ImageOrText<'a>>> for Context<'a>
Source§fn from(elements: Vec<ImageOrText<'a>>) -> Self
fn from(elements: Vec<ImageOrText<'a>>) -> Self
Converts to this type from the input type.
impl<'a> StructuralPartialEq for Context<'a>
Auto Trait Implementations§
impl<'a> Freeze for Context<'a>
impl<'a> RefUnwindSafe for Context<'a>
impl<'a> Send for Context<'a>
impl<'a> Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnwindSafe for Context<'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