pub struct DataUrl<'a> {
pub(crate) mime_type: Mime,
pub(crate) base64: bool,
pub(crate) encoded_body_plus_fragment: &'a str,
}
Fields§
§mime_type: Mime
§base64: bool
§encoded_body_plus_fragment: &'a str
Implementations§
source§impl<'a> DataUrl<'a>
impl<'a> DataUrl<'a>
sourcepub fn process(input: &'a str) -> Result<Self, DataUrlError>
pub fn process(input: &'a str) -> Result<Self, DataUrlError>
https://fetch.spec.whatwg.org/#data-url-processor
but starting from a string rather than a parsed Url
, to avoid extra string copies.
pub fn mime_type(&self) -> &Mime
sourcepub fn decode<F, E>(
&self,
write_body_bytes: F,
) -> Result<Option<FragmentIdentifier<'a>>, DecodeError<E>>
pub fn decode<F, E>( &self, write_body_bytes: F, ) -> Result<Option<FragmentIdentifier<'a>>, DecodeError<E>>
Streaming-decode the data URL’s body to write_body_bytes
,
and return the URL’s fragment identifier if it has one.
sourcepub fn decode_to_vec(
&self,
) -> Result<(Vec<u8>, Option<FragmentIdentifier<'a>>), InvalidBase64>
pub fn decode_to_vec( &self, ) -> Result<(Vec<u8>, Option<FragmentIdentifier<'a>>), InvalidBase64>
Return the decoded body, and the URL’s fragment identifier if it has one.
Auto Trait Implementations§
impl<'a> Freeze for DataUrl<'a>
impl<'a> RefUnwindSafe for DataUrl<'a>
impl<'a> Send for DataUrl<'a>
impl<'a> Sync for DataUrl<'a>
impl<'a> Unpin for DataUrl<'a>
impl<'a> UnwindSafe for DataUrl<'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