pub struct CodeFragment { /* private fields */ }Expand description
A parsed, composable code fragment.
CodeFragment is for snippets that should preserve sigil-stitch structure
such as %> / %< indentation markers. Raw &str / String values passed
through %L remain literal text; use CodeFragment::of(...) when a fragment
contains format markers that must compose structurally inside another block.
Implementations§
Source§impl CodeFragment
impl CodeFragment
Sourcepub fn of(format: &str, args: impl IntoArgs) -> Result<Self, SigilStitchError>
pub fn of(format: &str, args: impl IntoArgs) -> Result<Self, SigilStitchError>
Parse a format string and arguments into a composable fragment.
Sourcepub fn into_code_block(self) -> CodeBlock
pub fn into_code_block(self) -> CodeBlock
Convert this fragment into a CodeBlock.
Trait Implementations§
Source§impl Clone for CodeFragment
impl Clone for CodeFragment
Source§fn clone(&self) -> CodeFragment
fn clone(&self) -> CodeFragment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CodeFragment
impl Debug for CodeFragment
Source§impl<'de> Deserialize<'de> for CodeFragment
impl<'de> Deserialize<'de> for CodeFragment
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 From<CodeFragment> for Arg
impl From<CodeFragment> for Arg
Source§fn from(fragment: CodeFragment) -> Self
fn from(fragment: CodeFragment) -> Self
Converts to this type from the input type.
Source§impl IntoArgs for CodeFragment
Single parsed fragment arg.
impl IntoArgs for CodeFragment
Single parsed fragment arg.
Auto Trait Implementations§
impl Freeze for CodeFragment
impl RefUnwindSafe for CodeFragment
impl Send for CodeFragment
impl Sync for CodeFragment
impl Unpin for CodeFragment
impl UnsafeUnpin for CodeFragment
impl UnwindSafe for CodeFragment
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