[−][src]Struct localghost::History
The Web History API.
The History API represents the URL and forward/backward buttons in the browser. It's modeled as a stack where URLs can be pushed/popped, and a cursor can be moved forward/backward along the stack.
History
also implements Stream
which returns a url every time the
cursor is moved along the stack. The only time this event is not triggered is
when the cursor moves because of a new entry being pushed onto the stack.
Implementations
impl History
[src]
pub fn new() -> Self
[src]
Create a new instance of History
.
pub fn len(&self) -> usize
[src]
Returns the number of urls in the History stack.
pub fn current(&self) -> String
[src]
Get the current url from the History stack.
pub fn push(&self, url: &str)
[src]
Push a new url onto the history stack.
pub fn pop(&self)
[src]
Pop a url from the history stack.
pub fn replace(&self, url: &str)
[src]
Replace the url currently on the stack with another url.
pub async fn move_by<'_>(&'_ self, delta: i32)
[src]
Move the cursor forwards and backwards through the History stack depending on the value of the parameter.
Passing a value of 0
will reload the page.
pub async fn move_next<'_>(&'_ self)
[src]
Moves the cursor to the next url in the History stack.
pub async fn move_prev<'_>(&'_ self)
[src]
Moves the cursor to the previous url in the History stack.
pub async fn reload<'_>(&'_ self)
[src]
Reload the current url, like the Refresh button.
Trait Implementations
impl Debug for History
[src]
impl PinnedDrop for History
[src]
impl Stream for History
[src]
type Item = String
Values yielded by the stream.
fn poll_next(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<Self::Item>>
[src]
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<Self::Item>>
Return URLs generated by moving the cursor on the stack. This is
equivalent to listening for the "popstate"
event.
fn size_hint(&self) -> (usize, Option<usize>)
[src]
impl<'pin> Unpin for History where
__History<'pin>: Unpin,
[src]
__History<'pin>: Unpin,
impl UnsafeUnpin for History
[src]
Auto Trait Implementations
impl !RefUnwindSafe for History
impl !Send for History
impl !Sync for History
impl !UnwindSafe for History
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoStream for I where
I: Stream,
[src]
I: Stream,
type Item = <I as Stream>::Item
The type of the elements being iterated over.
type IntoStream = I
Which kind of stream are we turning this into?
pub fn into_stream(self) -> I
[src]
impl<T> StreamExt for T where
T: Stream + ?Sized,
[src]
T: Stream + ?Sized,
fn next(&mut self) -> NextFuture<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn take(self, n: usize) -> Take<Self>
[src]
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
P: FnMut(&Self::Item) -> bool,
[src]
P: FnMut(&Self::Item) -> bool,
fn throttle(self, d: Duration) -> Throttle<Self>
[src]
fn step_by(self, step: usize) -> StepBy<Self>
[src]
fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
fn cloned<'a, T>(self) -> Cloned<Self> where
Self: Stream<Item = &'a T>,
T: Clone + 'a,
[src]
Self: Stream<Item = &'a T>,
T: Clone + 'a,
fn copied<'a, T>(self) -> Copied<Self> where
Self: Stream<Item = &'a T>,
T: Copy + 'a,
[src]
Self: Stream<Item = &'a T>,
T: Copy + 'a,
fn cycle(self) -> Cycle<Self> where
Self: Clone,
[src]
Self: Clone,
fn enumerate(self) -> Enumerate<Self>
[src]
fn delay(self, dur: Duration) -> Delay<Self>
[src]
fn map<B, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> B,
[src]
F: FnMut(Self::Item) -> B,
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item),
[src]
F: FnMut(&Self::Item),
fn last(self) -> LastFuture<Self, Self::Item>
[src]
fn fuse(self) -> Fuse<Self>
[src]
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
P: FnMut(&Self::Item) -> bool,
[src]
P: FnMut(&Self::Item) -> bool,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
F: FnMut(Self::Item) -> U,
U: IntoStream,
[src]
F: FnMut(Self::Item) -> U,
U: IntoStream,
fn flatten(self) -> Flatten<Self> where
Self::Item: IntoStream,
[src]
Self::Item: IntoStream,
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
F: FnMut(Self::Item) -> Option<B>,
[src]
F: FnMut(Self::Item) -> Option<B>,
fn min_by_key<B, F>(self, key_by: F) -> MinByKeyFuture<Self, Self::Item, F> where
B: Ord,
F: FnMut(&Self::Item) -> B,
[src]
B: Ord,
F: FnMut(&Self::Item) -> B,
fn max_by_key<B, F>(self, key_by: F) -> MaxByKeyFuture<Self, Self::Item, F> where
B: Ord,
F: FnMut(&Self::Item) -> B,
[src]
B: Ord,
F: FnMut(&Self::Item) -> B,
fn min_by<F>(self, compare: F) -> MinByFuture<Self, F, Self::Item> where
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src]
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn max(self) -> MaxFuture<Self, Self::Item> where
Self::Item: Ord,
[src]
Self::Item: Ord,
fn min(self) -> MinFuture<Self, Self::Item> where
Self::Item: Ord,
[src]
Self::Item: Ord,
fn max_by<F>(self, compare: F) -> MaxByFuture<Self, F, Self::Item> where
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
[src]
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn nth(&mut self, n: usize) -> NthFuture<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F, Self::Item> where
F: FnMut(Self::Item) -> bool,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> bool,
Self: Unpin,
fn find<P>(&mut self, p: P) -> FindFuture<'_, Self, P> where
P: FnMut(&Self::Item) -> bool,
Self: Unpin,
[src]
P: FnMut(&Self::Item) -> bool,
Self: Unpin,
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> where
F: FnMut(Self::Item) -> Option<B>,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> Option<B>,
Self: Unpin,
fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, F, B> where
F: FnMut(B, Self::Item) -> B,
[src]
F: FnMut(B, Self::Item) -> B,
fn partition<B, F>(self, f: F) -> PartitionFuture<Self, F, B> where
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool,
[src]
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool,
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> where
F: FnMut(Self::Item),
[src]
F: FnMut(Self::Item),
fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F, Self::Item> where
F: FnMut(Self::Item) -> bool,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> bool,
Self: Unpin,
fn by_ref(&mut self) -> &mut Self
[src]
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where
F: FnMut(&mut St, Self::Item) -> Option<B>,
[src]
F: FnMut(&mut St, Self::Item) -> Option<B>,
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
P: FnMut(&Self::Item) -> bool,
[src]
P: FnMut(&Self::Item) -> bool,
fn skip(self, n: usize) -> Skip<Self>
[src]
fn timeout(self, dur: Duration) -> Timeout<Self> where
Self: Stream,
[src]
Self: Stream,
fn try_fold<B, F, T, E>(
&mut self,
init: T,
f: F
) -> TryFoldFuture<'_, Self, F, T> where
F: FnMut(B, Self::Item) -> Result<T, E>,
Self: Unpin,
[src]
&mut self,
init: T,
f: F
) -> TryFoldFuture<'_, Self, F, T> where
F: FnMut(B, Self::Item) -> Result<T, E>,
Self: Unpin,
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> where
F: FnMut(Self::Item) -> Result<(), E>,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> Result<(), E>,
Self: Unpin,
fn zip<U>(self, other: U) -> Zip<Self, U> where
U: Stream,
[src]
U: Stream,
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)>,
[src]
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)>,
fn collect<'a, B>(self) -> Pin<Box<dyn Future<Output = B> + 'a + Send>> where
B: FromStream<Self::Item>,
Self: 'a + Send,
Self::Item: Send,
[src]
B: FromStream<Self::Item>,
Self: 'a + Send,
Self::Item: Send,
fn merge<U>(self, other: U) -> Merge<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
fn partial_cmp<S>(self, other: S) -> PartialCmpFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> where
P: FnMut(Self::Item) -> bool,
Self: Unpin,
[src]
P: FnMut(Self::Item) -> bool,
Self: Unpin,
fn cmp<S>(self, other: S) -> CmpFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: Ord,
[src]
S: Stream,
Self: Stream,
Self::Item: Ord,
fn count(self) -> CountFuture<Self>
[src]
fn ne<S>(self, other: S) -> NeFuture<Self, S> where
S: Stream,
Self::Item: PartialEq<<S as Stream>::Item>,
[src]
S: Stream,
Self::Item: PartialEq<<S as Stream>::Item>,
fn ge<S>(self, other: S) -> GeFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
fn eq<S>(self, other: S) -> EqFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialEq<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialEq<<S as Stream>::Item>,
fn gt<S>(self, other: S) -> GtFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
fn le<S>(self, other: S) -> LeFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
fn lt<S>(self, other: S) -> LtFuture<Self, S> where
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
[src]
S: Stream,
Self: Stream,
Self::Item: PartialOrd<<S as Stream>::Item>,
fn sum<'a, S>(self) -> Pin<Box<dyn Future<Output = S> + 'a>> where
S: Sum<Self::Item>,
Self: Stream<Item = S> + 'a,
[src]
S: Sum<Self::Item>,
Self: Stream<Item = S> + 'a,
fn product<'a, P>(self) -> Pin<Box<dyn Future<Output = P> + 'a>> where
P: Product<P>,
Self: Stream<Item = P> + 'a,
[src]
P: Product<P>,
Self: Stream<Item = P> + 'a,
impl<S> StreamExt for S where
S: Stream + ?Sized,
S: Stream + ?Sized,
fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> where
Self: Unpin,
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self> where
Self: Unpin,
Self: Unpin,
fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self> where
Self: Stream<Item = Result<T, E>> + Unpin,
Self: Stream<Item = Result<T, E>> + Unpin,
fn count(self) -> CountFuture<Self>
fn map<T, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> T,
F: FnMut(Self::Item) -> T,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
F: FnMut(Self::Item) -> U,
U: Stream,
F: FnMut(Self::Item) -> U,
U: Stream,
fn flatten(self) -> Flatten<Self> where
Self::Item: Stream,
Self::Item: Stream,
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut> where
F: FnMut(Self::Item) -> Fut,
Fut: Future,
F: FnMut(Self::Item) -> Fut,
Fut: Future,
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
P: FnMut(&Self::Item) -> bool,
P: FnMut(&Self::Item) -> bool,
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F> where
F: FnMut(Self::Item) -> Option<T>,
F: FnMut(Self::Item) -> Option<T>,
fn take(self, n: usize) -> Take<Self>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
P: FnMut(&Self::Item) -> bool,
P: FnMut(&Self::Item) -> bool,
fn skip(self, n: usize) -> Skip<Self>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
P: FnMut(&Self::Item) -> bool,
P: FnMut(&Self::Item) -> bool,
fn step_by(self, step: usize) -> StepBy<Self>
fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Stream<Item = Self::Item>,
U: Stream<Item = Self::Item>,
fn cloned<'a, T>(self) -> Cloned<Self> where
Self: Stream<Item = &'a T>,
T: Clone + 'a,
Self: Stream<Item = &'a T>,
T: Clone + 'a,
fn copied<'a, T>(self) -> Copied<Self> where
Self: Stream<Item = &'a T>,
T: Copy + 'a,
Self: Stream<Item = &'a T>,
T: Copy + 'a,
fn collect<C>(self) -> CollectFuture<Self, C> where
C: Default + Extend<Self::Item>,
C: Default + Extend<Self::Item>,
fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C> where
C: Default + Extend<T>,
Self: Stream<Item = Result<T, E>>,
C: Default + Extend<T>,
Self: Stream<Item = Result<T, E>>,
fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B> where
B: Default + Extend<Self::Item>,
P: FnMut(&Self::Item) -> bool,
B: Default + Extend<Self::Item>,
P: FnMut(&Self::Item) -> bool,
fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T> where
F: FnMut(T, Self::Item) -> T,
F: FnMut(T, Self::Item) -> T,
fn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B> where
F: FnMut(B, T) -> Result<B, E>,
Self: Stream<Item = Result<T, E>> + Unpin,
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B> where
F: FnMut(B, T) -> Result<B, E>,
Self: Stream<Item = Result<T, E>> + Unpin,
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where
F: FnMut(&mut St, Self::Item) -> Option<B>,
F: FnMut(&mut St, Self::Item) -> Option<B>,
fn fuse(self) -> Fuse<Self>
fn cycle(self) -> Cycle<Self> where
Self: Clone,
Self: Clone,
fn enumerate(self) -> Enumerate<Self>
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item),
F: FnMut(&Self::Item),
fn nth(&mut self, n: usize) -> NthFuture<'_, Self> where
Self: Unpin,
Self: Unpin,
fn last(self) -> LastFuture<Self>
fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P> where
P: FnMut(&Self::Item) -> bool,
Self: Unpin,
P: FnMut(&Self::Item) -> bool,
Self: Unpin,
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> where
F: FnMut(Self::Item) -> Option<B>,
Self: Unpin,
F: FnMut(Self::Item) -> Option<B>,
Self: Unpin,
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> where
P: FnMut(Self::Item) -> bool,
Self: Unpin,
P: FnMut(Self::Item) -> bool,
Self: Unpin,
fn all<P>(&mut self, predicate: P) -> AllFuture<'_, Self, P> where
P: FnMut(Self::Item) -> bool,
Self: Unpin,
P: FnMut(Self::Item) -> bool,
Self: Unpin,
fn any<P>(&mut self, predicate: P) -> AnyFuture<'_, Self, P> where
P: FnMut(Self::Item) -> bool,
Self: Unpin,
P: FnMut(Self::Item) -> bool,
Self: Unpin,
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> where
F: FnMut(Self::Item),
F: FnMut(Self::Item),
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> where
F: FnMut(Self::Item) -> Result<(), E>,
Self: Unpin,
F: FnMut(Self::Item) -> Result<(), E>,
Self: Unpin,
fn zip<U>(self, other: U) -> Zip<Self, U> where
U: Stream,
U: Stream,
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)>,
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Stream<Item = (A, B)>,
fn or<S>(self, other: S) -> Or<Self, S> where
S: Stream<Item = Self::Item>,
S: Stream<Item = Self::Item>,
fn race<S>(self, other: S) -> Race<Self, S> where
S: Stream<Item = Self::Item>,
S: Stream<Item = Self::Item>,
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a + Send>> where
Self: Send + 'a,
Self: Send + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>> where
Self: 'a,
Self: 'a,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,