[][src]Struct localghost::Location

pub struct Location { /* fields omitted */ }

Representation of the location (URL) of the object it is linked to.

Implementations

impl Location[src]

pub fn new() -> Self[src]

Create a new instance of Location by reading document.location.

pub fn href(&self) -> String[src]

Access the URL at the current location.

pub fn assign(&self, url: &str) -> Result<()>[src]

Loads the resource at the URL provided in parameter.

Errors

An error may be returned if the url is malformed.

pub fn replace(&self, url: &str) -> Result<()>[src]

Replaces the current resource with the one at the provided URL.

The difference from the assign method is that after using replace the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it

Errors

An error may be returned if the url is malformed.

pub fn reload(&self) -> Result<()>[src]

Reloads the current URL, like the Refresh button.

Errors

An error may be returned if the origin of the script calling reload differs from the origin of the page that owns the Location object.

Trait Implementations

impl Debug for Location[src]

impl Display for Location[src]

Auto Trait Implementations

impl RefUnwindSafe for Location

impl !Send for Location

impl !Sync for Location

impl Unpin for Location

impl UnwindSafe for Location

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<T> ToString for T where
    T: Display + ?Sized
[src]

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.