pub struct StoreSink { /* private fields */ }Available on crate feature
fs only.Expand description
The Sink a Store hands out for one request.
§Examples
use form_net::{Boundary, Driver, Limits, MultipartParser, NoInspector, Policy, Progress, Store};
let store = Store::memory_only();
let parser = MultipartParser::new(Boundary::new(b"X")?, &Limits::DEFAULT, &Policy::DEFAULT)?;
let mut driver = Driver::new(parser, store.sink(&Limits::DEFAULT));
let body = b"--X\r\nContent-Disposition: form-data; name=f; filename=a.txt\r\n\r\nhello\r\n--X--";
let (_, progress) = driver.push(body, true, &mut NoInspector)?;
// The sink's output is a `StoredFile`, counted by the store.
assert!(matches!(progress, Progress::File(ref f) if f.name() == "f"));
assert_eq!(store.stats().files_in_memory, 1);Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StoreSink
impl !UnwindSafe for StoreSink
impl Forget for StoreSink
impl Freeze for StoreSink
impl Move for StoreSink
impl Send for StoreSink
impl Sync for StoreSink
impl Unpin for StoreSink
impl UnsafeUnpin for StoreSink
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