Enum zng::image::ImageSourceFilter
source · pub enum ImageSourceFilter<U> {
BlockAll,
AllowAll,
Custom(Arc<dyn Fn(&U) -> bool + Sync + Send>),
}
Expand description
Represents a PathFilter
and UriFilter
.
Variants§
BlockAll
Block all requests of this type.
AllowAll
Allow all requests of this type.
Custom(Arc<dyn Fn(&U) -> bool + Sync + Send>)
Custom filter, returns true
to allow a request, false
to block.
Implementations§
source§impl<U> ImageSourceFilter<U>
impl<U> ImageSourceFilter<U>
sourcepub fn custom(
allow: impl Fn(&U) -> bool + Send + Sync + 'static,
) -> ImageSourceFilter<U>
pub fn custom( allow: impl Fn(&U) -> bool + Send + Sync + 'static, ) -> ImageSourceFilter<U>
New Custom
filter.
sourcepub fn and(self, other: ImageSourceFilter<U>) -> ImageSourceFilter<U>where
U: 'static,
pub fn and(self, other: ImageSourceFilter<U>) -> ImageSourceFilter<U>where
U: 'static,
sourcepub fn or(self, other: ImageSourceFilter<U>) -> ImageSourceFilter<U>where
U: 'static,
pub fn or(self, other: ImageSourceFilter<U>) -> ImageSourceFilter<U>where
U: 'static,
source§impl ImageSourceFilter<PathBuf>
impl ImageSourceFilter<PathBuf>
sourcepub fn allow_dir(dir: impl AsRef<Path>) -> ImageSourceFilter<PathBuf>
pub fn allow_dir(dir: impl AsRef<Path>) -> ImageSourceFilter<PathBuf>
Allow any file inside dir
or sub-directories of dir
.
sourcepub fn allow_ext(ext: impl Into<OsString>) -> ImageSourceFilter<PathBuf>
pub fn allow_ext(ext: impl Into<OsString>) -> ImageSourceFilter<PathBuf>
Allow any path with the ext
extension.
sourcepub fn allow_current_dir() -> ImageSourceFilter<PathBuf>
pub fn allow_current_dir() -> ImageSourceFilter<PathBuf>
Allow any file inside the env::current_dir
or sub-directories.
Note that the current directory can be changed and the filter always uses the
fresh current directory, use allow_dir
to create a filter the always points
to the current directory at the filter creation time.
sourcepub fn allow_exe_dir() -> ImageSourceFilter<PathBuf>
pub fn allow_exe_dir() -> ImageSourceFilter<PathBuf>
Allow any file inside the current executable directory or sub-directories.
source§impl ImageSourceFilter<Uri>
impl ImageSourceFilter<Uri>
sourcepub fn allow_host(host: impl Into<Txt>) -> ImageSourceFilter<Uri>
pub fn allow_host(host: impl Into<Txt>) -> ImageSourceFilter<Uri>
Allow any file from the host
site.
Trait Implementations§
source§impl<U> BitAnd for ImageSourceFilter<U>where
U: 'static,
impl<U> BitAnd for ImageSourceFilter<U>where
U: 'static,
source§type Output = ImageSourceFilter<U>
type Output = ImageSourceFilter<U>
The resulting type after applying the
&
operator.source§fn bitand(
self,
rhs: ImageSourceFilter<U>,
) -> <ImageSourceFilter<U> as BitAnd>::Output
fn bitand( self, rhs: ImageSourceFilter<U>, ) -> <ImageSourceFilter<U> as BitAnd>::Output
Performs the
&
operation. Read moresource§impl<U> BitAndAssign for ImageSourceFilter<U>where
U: 'static,
impl<U> BitAndAssign for ImageSourceFilter<U>where
U: 'static,
source§fn bitand_assign(&mut self, rhs: ImageSourceFilter<U>)
fn bitand_assign(&mut self, rhs: ImageSourceFilter<U>)
Performs the
&=
operation. Read moresource§impl<U> BitOr for ImageSourceFilter<U>where
U: 'static,
impl<U> BitOr for ImageSourceFilter<U>where
U: 'static,
source§type Output = ImageSourceFilter<U>
type Output = ImageSourceFilter<U>
The resulting type after applying the
|
operator.source§fn bitor(
self,
rhs: ImageSourceFilter<U>,
) -> <ImageSourceFilter<U> as BitOr>::Output
fn bitor( self, rhs: ImageSourceFilter<U>, ) -> <ImageSourceFilter<U> as BitOr>::Output
Performs the
|
operation. Read moresource§impl<U> BitOrAssign for ImageSourceFilter<U>where
U: 'static,
impl<U> BitOrAssign for ImageSourceFilter<U>where
U: 'static,
source§fn bitor_assign(&mut self, rhs: ImageSourceFilter<U>)
fn bitor_assign(&mut self, rhs: ImageSourceFilter<U>)
Performs the
|=
operation. Read moresource§impl<U> Clone for ImageSourceFilter<U>where
U: Clone,
impl<U> Clone for ImageSourceFilter<U>where
U: Clone,
source§fn clone(&self) -> ImageSourceFilter<U>
fn clone(&self) -> ImageSourceFilter<U>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<U> Debug for ImageSourceFilter<U>
impl<U> Debug for ImageSourceFilter<U>
source§impl<F> From<F> for ImageSourceFilter<PathBuf>
impl<F> From<F> for ImageSourceFilter<PathBuf>
source§fn from(custom: F) -> ImageSourceFilter<PathBuf>
fn from(custom: F) -> ImageSourceFilter<PathBuf>
Converts to this type from the input type.
source§impl<F> From<F> for ImageSourceFilter<Uri>
impl<F> From<F> for ImageSourceFilter<Uri>
source§fn from(custom: F) -> ImageSourceFilter<Uri>
fn from(custom: F) -> ImageSourceFilter<Uri>
Converts to this type from the input type.
source§impl<U> PartialEq for ImageSourceFilter<U>
impl<U> PartialEq for ImageSourceFilter<U>
Auto Trait Implementations§
impl<U> Freeze for ImageSourceFilter<U>
impl<U> !RefUnwindSafe for ImageSourceFilter<U>
impl<U> Send for ImageSourceFilter<U>
impl<U> Sync for ImageSourceFilter<U>
impl<U> Unpin for ImageSourceFilter<U>
impl<U> !UnwindSafe for ImageSourceFilter<U>
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Access to mut
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
Clone the value.
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
Clone the value into a new boxed
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self
equals other
.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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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
source§impl<T> FsChangeNote for T
impl<T> FsChangeNote 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> 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>
Converts
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>
Converts
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