[][src]Struct localghost::History

pub struct History { /* fields omitted */ }

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]

Return URLs generated by moving the cursor on the stack. This is equivalent to listening for the "popstate" event.

impl<'pin> Unpin for History where
    __History<'pin>: Unpin
[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoStream for I where
    I: Stream
[src]

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?

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<S> StreamExt for S where
    S: Stream + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.