pub struct Previews(/* private fields */);Expand description
The preview providers, their cache and their worker, as a service of
Files.
Implementations§
Source§impl Previews
impl Previews
Sourcepub fn register(&self, provider: Arc<dyn PreviewProvider>)
pub fn register(&self, provider: Arc<dyn PreviewProvider>)
Adds a provider.
Sourcepub fn providers(&self) -> Vec<(String, i32)>
pub fn providers(&self) -> Vec<(String, i32)>
The providers, highest priority first: id and priority.
Sourcepub fn set_cache_bytes(&self, bytes: usize)
pub fn set_cache_bytes(&self, bytes: usize)
The cache’s size in bytes; the oldest previews go first past it.
Sourcepub fn set_max_side(&self, pixels: u32)
pub fn set_max_side(&self, pixels: u32)
The longest side of a preview’s image, in pixels.
Sourcepub fn set_max_bytes(&self, bytes: usize)
pub fn set_max_bytes(&self, bytes: usize)
The most bytes a provider reads.
Sourcepub fn get(&self, ctx: &Context, fs: &SharedFs, path: &Path) -> Shown
pub fn get(&self, ctx: &Context, fs: &SharedFs, path: &Path) -> Shown
A path’s preview: from the cache, else asked of the worker
(Shown::Loading; the path asked before, unless it is done, is
cancelled). The context is woken when it is ready.
Sourcepub fn want(&self, ctx: &Context, fs: &SharedFs, wanted: &[(PathBuf, Meta)])
pub fn want(&self, ctx: &Context, fs: &SharedFs, wanted: &[(PathBuf, Meta)])
The paths a grid has in view, in the order it wants them, and their
facts (the frame reads no file here): replaces what it said before.
What is not made yet goes to the worker, one at a time, behind the
preview asked with Previews::get, and the context is woken as each
is ready; what left the view leaves the queue, and is cancelled when
in the making. None: nothing is wanted any more.
Sourcepub fn thumbnail(&self, path: &Path, meta: &Meta) -> Shown
pub fn thumbnail(&self, path: &Path, meta: &Meta) -> Shown
A path’s thumbnail as it is now, its facts given (the frame reads no
file here): made, or Shown::Loading whether it was asked or not.
Sourcepub fn peek(&self, fs: &SharedFs, path: &Path) -> Shown
pub fn peek(&self, fs: &SharedFs, path: &Path) -> Shown
What is known of a path’s preview without asking for it.
Sourcepub fn compute(&self, fs: &SharedFs, path: &Path) -> Shown
pub fn compute(&self, fs: &SharedFs, path: &Path) -> Shown
A path’s preview made now, on this thread (agents and tests), or from the cache; kept in the cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Previews
impl RefUnwindSafe for Previews
impl Send for Previews
impl Sync for Previews
impl Unpin for Previews
impl UnsafeUnpin for Previews
impl UnwindSafe for Previews
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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>
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 more