pub enum MimeData {
String(String),
Lines(Vec<String>),
Json(Value),
}Expand description
Data for a single MIME type in an output.
The data can be either:
- A single string (for small text content)
- An array of strings (lines, joined with newlines)
- A JSON object (for structured data like plotly)
For binary data (like images), the content is base64-encoded.
Variants§
String(String)
Single string value.
Lines(Vec<String>)
Array of strings (typically lines).
Json(Value)
JSON object data (for structured formats like plotly).
Implementations§
Source§impl MimeData
impl MimeData
Sourcepub fn as_string(&self) -> String
pub fn as_string(&self) -> String
Get the content as a single string.
For Lines variant, joins with empty string (lines typically
include their own newlines).
For Json variant, returns the JSON as a string.
Sourcepub fn from_string(s: String) -> Self
pub fn from_string(s: String) -> Self
Create MimeData from a string, preserving line structure.
Sourcepub fn from_lines(lines: Vec<String>) -> Self
pub fn from_lines(lines: Vec<String>) -> Self
Create MimeData from lines.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MimeData
impl<'de> Deserialize<'de> for MimeData
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 MimeData
Auto Trait Implementations§
impl Freeze for MimeData
impl RefUnwindSafe for MimeData
impl Send for MimeData
impl Sync for MimeData
impl Unpin for MimeData
impl UnwindSafe for MimeData
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