pub struct DeepLinks {
pub initial: Option<String>,
pub latest: RwSignal<Option<DeepLink>>,
}Expand description
The deep-link read surface (frust-reactive’s app_links-
style process-wide source — see its module docs for the semantics): a
mobile shell delivers a platform link via frust-reactive’s
push_deep_link, and app code reads it here —
deep_links() returns a DeepLinks snapshot (DeepLinks::initial)
plus the live, trackable DeepLinks::latest signal a
Component::build reads to react to cold-start and subsequent links
uniformly. Router auto-wiring (resolving deep_links() against a
Router) is a separate opt-in, not automatic here.
use frust::{AnyView, Route, Router, any, deep_links, text};
struct AppState;
struct NavDemo;
fn build_router() -> Router<AppState> {
Router::new(vec![Route::new("/", |_params| -> AnyView<AppState> {
any(text("home"))
})])
}
impl frust::Component for NavDemo {
type State = AppState;
fn init(&self) -> AppState {
AppState
}
fn build(&self, _state: &mut AppState) -> AnyView<AppState> {
let _router = build_router();
// A late-subscribed read: `initial` sees a cold-start link (if any);
// `latest` is the live signal a rebuild tracks for warm links.
let links = deep_links();
let _ = links.initial;
let _ = links.latest;
any(text("nav demo"))
}
}push_deep_link is normally called by a mobile shell’s platform-link
handler; it is also re-exported here as the desktop dev seam
(no shell writes on desktop yet) — examples/navdemo‘s
“simulate deep link” button calls it directly to demonstrate warm-link
navigation without a real platform link.
The app-facing deep-link read surface (see the module docs’ app_links
semantics). Obtained via deep_links (frust::deep_links() at the
facade).
Fields§
§initial: Option<String>The first link ever pushed in this process, if any — a plain
snapshot taken when deep_links is called, not itself reactive.
The underlying value is set at most once (idempotent), so repeated
calls to deep_links see the same initial once it exists.
latest: RwSignal<Option<DeepLink>>The most recently pushed link — cold-start or warm, uniformly (see
the module docs). Use DeepLink::sequence to deduplicate deliveries.
Read/track it with the Get/Track traits (frust::{Get, Track})
the same way any other RwSignal is read.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeepLinks
impl RefUnwindSafe for DeepLinks
impl Send for DeepLinks
impl Sync for DeepLinks
impl Unpin for DeepLinks
impl UnsafeUnpin for DeepLinks
impl UnwindSafe for DeepLinks
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.