pub struct DeepLinkConfig {
pub schemes: Vec<String>,
pub domains: Vec<String>,
pub path_prefixes: Vec<String>,
}Expand description
Declarative runtime filter for inbound deep links.
Fields§
§schemes: Vec<String>§domains: Vec<String>§path_prefixes: Vec<String>Implementations§
Source§impl DeepLinkConfig
impl DeepLinkConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty deep-link configuration.
Add schemes, domains, and optional path prefixes before installing it in a shell. An empty config intentionally matches no URLs.
Sourcepub fn scheme(self, scheme: impl Into<String>) -> Self
pub fn scheme(self, scheme: impl Into<String>) -> Self
Allows a custom URL scheme.
scheme is normalized by trimming whitespace, removing a trailing colon,
and lowercasing. Use this for routes such as myapp://item/123.
Sourcepub fn domain(self, domain: impl Into<String>) -> Self
pub fn domain(self, domain: impl Into<String>) -> Self
Allows an HTTP or HTTPS domain.
domain is normalized by trimming whitespace, removing a trailing dot,
and lowercasing. Use this for app links, universal links, and web routes
that should enter the Fission app.
Sourcepub fn path_prefix(self, prefix: impl Into<String>) -> Self
pub fn path_prefix(self, prefix: impl Into<String>) -> Self
Restricts accepted links to a path prefix.
Prefixes are normalized to start with /. Add one or more prefixes when
only part of a domain should route into the app, such as /invite or
/checkout.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true when no scheme, domain, or path rule has been configured.
Empty configs match no URLs. This prevents a shell from accidentally accepting every external URL before the app has declared its routes.
Sourcepub fn matches(&self, url: &str) -> bool
pub fn matches(&self, url: &str) -> bool
Returns whether a URL is accepted by this deep-link configuration.
url is parsed as a simple absolute URL. The URL matches when its scheme
or domain is allowed and, if path prefixes were configured, its path starts
with one of those prefixes.
Sourcepub fn source_for(&self, url: &str) -> DeepLinkSource
pub fn source_for(&self, url: &str) -> DeepLinkSource
Classifies a URL according to this configuration.
Use this in shell code when creating DeepLinkReceived actions. The
result distinguishes configured custom schemes and associated domains from
ordinary web URLs or external URLs.
Trait Implementations§
Source§impl Clone for DeepLinkConfig
impl Clone for DeepLinkConfig
Source§fn clone(&self) -> DeepLinkConfig
fn clone(&self) -> DeepLinkConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeepLinkConfig
impl Debug for DeepLinkConfig
Source§impl Default for DeepLinkConfig
impl Default for DeepLinkConfig
Source§fn default() -> DeepLinkConfig
fn default() -> DeepLinkConfig
Source§impl<'de> Deserialize<'de> for DeepLinkConfig
impl<'de> Deserialize<'de> for DeepLinkConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DeepLinkConfig
impl PartialEq for DeepLinkConfig
Source§fn eq(&self, other: &DeepLinkConfig) -> bool
fn eq(&self, other: &DeepLinkConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for DeepLinkConfig
impl Serialize for DeepLinkConfig
impl Eq for DeepLinkConfig
impl StructuralPartialEq for DeepLinkConfig
Auto Trait Implementations§
impl Freeze for DeepLinkConfig
impl RefUnwindSafe for DeepLinkConfig
impl Send for DeepLinkConfig
impl Sync for DeepLinkConfig
impl Unpin for DeepLinkConfig
impl UnsafeUnpin for DeepLinkConfig
impl UnwindSafe for DeepLinkConfig
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.