pub struct ImageStore {
pub keep: fn(source: Source<'_>, editor: &Entity<Editor>, cx: &App) -> Option<String>,
pub accepts: fn(path: &Path) -> bool,
}Expand description
Who owns the pictures a document points at.
Plain fn fields rather than a trait: a store needs state — which
article is open, where the vault is — and in gpui that state lives in the
app, not in a capture. So the store is handed &App and the editor doing
the asking, and looks its answer up the same way everything else here does.
Nothing to box, and Default means a field added later is not a break.
Fields§
§keep: fn(source: Source<'_>, editor: &Entity<Editor>, cx: &App) -> Option<String>The URL to write down for source, and None for one the app will not
keep — a dropped file then stays where it already is, and a screenshot
is let go.
editor is which document is asking, because an app with two windows
open has two answers and a bare call has no way to tell them apart.
accepts: fn(path: &Path) -> boolWhether a file is a picture at all. Defaults to markdown::is_image,
which guesses from the extension — an app with its own decoder, or one
that wants a file the guess rejects, says so here.
Trait Implementations§
Source§impl Clone for ImageStore
impl Clone for ImageStore
Source§fn clone(&self) -> ImageStore
fn clone(&self) -> ImageStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ImageStore
Auto Trait Implementations§
impl Freeze for ImageStore
impl RefUnwindSafe for ImageStore
impl Send for ImageStore
impl Sync for ImageStore
impl Unpin for ImageStore
impl UnsafeUnpin for ImageStore
impl UnwindSafe for ImageStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().