pub struct DeepLink<R: Runtime> { /* private fields */ }Expand description
Access to the deep-link APIs.
Implementations§
Source§impl<R: Runtime> DeepLink<R>
impl<R: Runtime> DeepLink<R>
Sourcepub fn get_current(&self) -> Result<Option<Vec<Url>>>
pub fn get_current(&self) -> Result<Option<Vec<Url>>>
Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link.
§Platform-specific:
- Windows / Linux: This function reads the command line arguments and checks if there’s only one value, which must be an URL with scheme matching one of the configured values.
Note that you must manually check the arguments when registering deep link schemes dynamically with
Self::register. Additionally, the deep link might have been provided as a CLI argument so you should check if its format matches what you expect.
Sourcepub fn register<S: AsRef<str>>(&self, _protocol: S) -> Result<()>
pub fn register<S: AsRef<str>>(&self, _protocol: S) -> Result<()>
Register the app as the default handler for the specified protocol.
protocol: The name of the protocol without://. For example, if you want your app to handletauri://links, call this method withtaurias the protocol.
§Platform-specific:
- macOS / Android / iOS: Unsupported, will return
Error::UnsupportedPlatform.
Sourcepub fn unregister<S: AsRef<str>>(&self, _protocol: S) -> Result<()>
pub fn unregister<S: AsRef<str>>(&self, _protocol: S) -> Result<()>
Unregister the app as the default handler for the specified protocol.
protocol: The name of the protocol without://.
§Platform-specific:
- Linux: Can only unregister the scheme if it was initially registered with
register. May not work on older distros. - macOS / Android / iOS: Unsupported, will return
Error::UnsupportedPlatform.
Sourcepub fn is_registered<S: AsRef<str>>(&self, _protocol: S) -> Result<bool>
pub fn is_registered<S: AsRef<str>>(&self, _protocol: S) -> Result<bool>
Check whether the app is the default handler for the specified protocol.
protocol: The name of the protocol without://.
§Platform-specific:
- macOS / Android / iOS: Unsupported, will return
Error::UnsupportedPlatform.
Source§impl<R: Runtime> DeepLink<R>
impl<R: Runtime> DeepLink<R>
Sourcepub fn on_open_url<F: Fn(OpenUrlEvent) + Send + Sync + 'static>(
&self,
f: F,
) -> EventId
pub fn on_open_url<F: Fn(OpenUrlEvent) + Send + Sync + 'static>( &self, f: F, ) -> EventId
Helper function for the deep-link://new-url event to run a function each time the protocol is triggered while the app is running.
Use get_current on app load to check whether your app was started via a deep link.
Auto Trait Implementations§
impl<R> Freeze for DeepLink<R>
impl<R> !RefUnwindSafe for DeepLink<R>
impl<R> Send for DeepLink<R>
impl<R> Sync for DeepLink<R>
impl<R> Unpin for DeepLink<R>
impl<R> !UnwindSafe for DeepLink<R>
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
Mutably borrows from an owned value. Read more