pub struct Memory(Rc<Held>);Expand description
A container’s bytes, keyed by entry name, dying with the process.
A handle on a map rather than the map itself: cloning one hands a second container the same bytes, which is what re-opening a container means where there is no directory to point at twice.
Tuple Fields§
§0: Rc<Held>Implementations§
Source§impl Memory
impl Memory
Sourcepub fn resident(name: &str) -> Self
pub fn resident(name: &str) -> Self
Read whole at open, with futures that are ready anyway — the residency without the waiting.
Sourcepub fn deferred(name: &str) -> Self
pub fn deferred(name: &str) -> Self
A map as asynchronous as origin-private storage is: every future
answers Pending once before it completes, so nothing may resolve
one by polling it — and, as Storage::release requires of such a
storage, a lock of its own rather than an entry it could not remove
as it is dropped.
Sourcepub fn refusing(self, at: Entry) -> Self
pub fn refusing(self, at: Entry) -> Self
A map that will not write at, so a storage that fails partway
through what it was handed can be stood up without breaking one.
fn with(name: &str, residency: Residency, pace: Pace) -> Self
Sourcepub fn reads(&self) -> usize
pub fn reads(&self) -> usize
How many entries have been read out of this map — the count that must stop moving once a resident container is open.
Sourceasync fn paced(&self)
async fn paced(&self)
Answer Pending once where this map is the deferred kind, so a
caller that resolves its futures by polling them is caught.
fn read_one(&self)
fn wrote_one(&self, at: &Entry) -> Result<()>
Trait Implementations§
Source§impl Storage for Memory
impl Storage for Memory
Source§fn names(&self, at: &Entry) -> String
fn names(&self, at: &Entry) -> String
at — a platform path where there is one. Not
a promise that anything is there.fn residency(&self) -> Residency
Source§async fn read<'a>(&'a self, at: &'a Entry) -> Result<Option<Vec<u8>>>
async fn read<'a>(&'a self, at: &'a Entry) -> Result<Option<Vec<u8>>>
at, or None where nothing is — which is not the
same as a read that did not work.Source§async fn exists<'a>(&'a self, at: &'a Entry) -> Result<bool>
async fn exists<'a>(&'a self, at: &'a Entry) -> Result<bool>
at. Separate from Self::read
because a payload is filed under a content hash, so the answer is
all a write needs — and reading a megabyte to learn it is already
there is the one thing that would make every commit cost the
artwork on the page.Source§async fn write<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
async fn write<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
Source§async fn append<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
async fn append<'a>(&'a self, at: &'a Entry, bytes: &'a [u8]) -> Result<()>
bytes to the end of at, durably before returning.async fn truncate<'a>(&'a self, at: &'a Entry, len: u64) -> Result<()>
Source§async fn list<'a>(&'a self, dir: &'a Entry) -> Result<Vec<String>>
async fn list<'a>(&'a self, dir: &'a Entry) -> Result<Vec<String>>
dir holds, by name, in no particular order.async fn remove<'a>(&'a self, at: &'a Entry) -> Result<()>
Source§async fn create_dir<'a>(&'a self, dir: &'a Entry) -> Result<()>
async fn create_dir<'a>(&'a self, dir: &'a Entry) -> Result<()>
dir a place entries can be written.Source§async fn rename<'a>(&'a mut self, to: &'a Name) -> Result<()>
async fn rename<'a>(&'a mut self, to: &'a Name) -> Result<()>
Source§async fn discard(&self) -> Result<()>
async fn discard(&self) -> Result<()>
Auto Trait Implementations§
impl Freeze for Memory
impl !RefUnwindSafe for Memory
impl !Send for Memory
impl !Sync for Memory
impl Unpin for Memory
impl UnsafeUnpin for Memory
impl !UnwindSafe for Memory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more