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.
Sourcepub fn allow_res() -> ImageSourceFilter<PathBuf>
pub fn allow_res() -> ImageSourceFilter<PathBuf>
Allow any file inside the zng::env::res 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 duplicate 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 T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Clone the value.
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
Gets if
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
Swap value with
other if both are of the same type.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,
§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