pub struct MarkdownToParts<'a> { /* private fields */ }Implementations§
Source§impl<'a> MarkdownToParts<'a>
impl<'a> MarkdownToParts<'a>
Sourcepub async fn from_regex(
markdown: &'a str,
regex: Regex,
guess_mime_type: fn(url: &str) -> String,
) -> Self
pub async fn from_regex( markdown: &'a str, regex: Regex, guess_mime_type: fn(url: &str) -> String, ) -> Self
§Panics
regex must have a Regex with atleast 1 capture group with file URL as first capture group, else it PANICS.
§Arguments
guess_mime_type is used to detect mimi_type of URL pointing to file system or web resource
with no “Content-Type” header.
§Example
ⓘ
from_regex("Your markdown string...", Regex::new(r"(?s)!\[.*?].?\((.*?)\)").unwrap(), |_| "image/png".to_string())Sourcepub async fn new(
markdown: &'a str,
guess_mime_type: fn(url: &str) -> String,
) -> Self
pub async fn new( markdown: &'a str, guess_mime_type: fn(url: &str) -> String, ) -> Self
Converts markdown to parts considering  means Gemini will be see the images too. link can be URL or file path.
guess_mime_type is used to detect mimi_type of URL pointing to file system or web resource
with no “Content-Type” header.
§Example
ⓘ
new("Your markdown string...", |_| "image/png".to_string())pub fn process(self) -> Vec<Part>
Auto Trait Implementations§
impl<'a> Freeze for MarkdownToParts<'a>
impl<'a> RefUnwindSafe for MarkdownToParts<'a>
impl<'a> Send for MarkdownToParts<'a>
impl<'a> Sync for MarkdownToParts<'a>
impl<'a> Unpin for MarkdownToParts<'a>
impl<'a> UnwindSafe for MarkdownToParts<'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