pub enum Block {
Txt(TextBlock),
Img(ImageBlock),
Tdo(TodoBlock),
Fnc(FunctionBlock),
Api(ApiBlock),
Lfc(LifecycleBlock),
Chr(CharacterBlock),
Emo(EmotionBlock),
Enc(EncryptionBlock),
Orc(OrchestrationBlock),
}Expand description
A typed block payload.
Variants§
Txt(TextBlock)
See TextBlock.
Img(ImageBlock)
See ImageBlock.
Tdo(TodoBlock)
See TodoBlock.
Fnc(FunctionBlock)
See FunctionBlock.
Api(ApiBlock)
See ApiBlock.
Lfc(LifecycleBlock)
See LifecycleBlock.
Chr(CharacterBlock)
See CharacterBlock.
Emo(EmotionBlock)
See EmotionBlock.
Enc(EncryptionBlock)
See EncryptionBlock.
Orc(OrchestrationBlock)
See OrchestrationBlock.
Implementations§
Source§impl Block
impl Block
Sourcepub fn payload(&self) -> Result<Vec<u8>>
pub fn payload(&self) -> Result<Vec<u8>>
Serializes the inner block struct to JSON bytes (the type is carried by the container, not embedded in the payload).
Sourcepub fn from_payload(tag: BlockTag, bytes: &[u8]) -> Result<Block>
pub fn from_payload(tag: BlockTag, bytes: &[u8]) -> Result<Block>
Inverse of Block::payload: parses a JSON payload for tag.
Sourcepub fn as_encryption(&self) -> Option<&EncryptionBlock>
pub fn as_encryption(&self) -> Option<&EncryptionBlock>
If this is an Enc block, returns the encryption directive.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
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 StructuralPartialEq for Block
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