pub struct AsyncMediaSource<R> { /* private fields */ }Implementations§
Source§impl AsyncMediaSource<Empty>
impl AsyncMediaSource<Empty>
Sourcepub fn from_memory(bytes: impl Into<Bytes>) -> Result<Self>
pub fn from_memory(bytes: impl Into<Bytes>) -> Result<Self>
Build an AsyncMediaSource from an in-memory byte payload.
Async counterpart of crate::MediaSource::from_memory. Returns
AsyncMediaSource<tokio::io::Empty>, which satisfies the
<R: AsyncRead + Unpin + Send> bound on
MediaParser::parse_exif_async,
parse_track_async, and
parse_image_metadata_async
so a single async entry point per “what to parse” handles both
streaming and in-memory inputs.
Accepts any type convertible into bytes::Bytes — Bytes,
Vec<u8>, &'static [u8], String, Box<[u8]>, plus HTTP-stack
body types implementing Into<Bytes>. Zero-copy: parsed
ExifIter / sub-IFDs share the original Bytes via reference
counting, no copy.
§Example
use nom_exif::{AsyncMediaSource, MediaKind, MediaParser};
let bytes = tokio::fs::read("./testdata/exif.jpg").await?;
let ms = AsyncMediaSource::from_memory(bytes)?;
assert_eq!(ms.kind(), MediaKind::Image);
let mut parser = MediaParser::new();
let _iter = parser.parse_exif_async(ms).await?;Source§impl<R: AsyncRead + Unpin + Send> AsyncMediaSource<R>
impl<R: AsyncRead + Unpin + Send> AsyncMediaSource<R>
pub async fn unseekable(reader: R) -> Result<Self>
Source§impl AsyncMediaSource<File>
impl AsyncMediaSource<File>
Trait Implementations§
Auto Trait Implementations§
impl<R> !Freeze for AsyncMediaSource<R>
impl<R> RefUnwindSafe for AsyncMediaSource<R>where
R: RefUnwindSafe,
impl<R> Send for AsyncMediaSource<R>where
R: Send,
impl<R> Sync for AsyncMediaSource<R>where
R: Sync,
impl<R> Unpin for AsyncMediaSource<R>where
R: Unpin,
impl<R> UnsafeUnpin for AsyncMediaSource<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for AsyncMediaSource<R>where
R: UnwindSafe,
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