Skip to main content

WasmWindow

Struct WasmWindow 

Source
pub struct WasmWindow(/* private fields */);

Implementations§

Source§

impl WasmWindow

Source

pub fn document(&self) -> WasmToolkitResult<WasmDocument>

Source

pub fn location(&self) -> Location

Source

pub fn protocol(&self) -> WasmToolkitResult<String>

The protocol property of the URL interface is a string containing the protocol or scheme of the URL, including the final “:”.

This property can be set to change the protocol of the URL. A “:” is appended to the provided string if not provided. The provided scheme has to be compatible with the rest of the URL to be considered valid.

Source

pub fn port(&self) -> WasmToolkitResult<String>

The port property of the URL interface is a string containing the port number of the URL. If the port is the default for the protocol (80 for ws: and http:, 443 for wss: and https:, and 21 for ftp:), this property contains an empty string, “”.

This property can be set to change the port of the URL. If the URL has no host or its scheme is file:, then setting this property has no effect. It also silently ignores invalid port numbers.

Source

pub fn hostname(&self) -> WasmToolkitResult<String>

The hostname property of the URL interface is a string containing either the domain name or IP address of the URL. If the URL does not have a hostname, this property contains an empty string, “”. IPv4 and IPv6 addresses are normalized, such as stripping leading zeros, and domain names are converted to IDN.

This property can be set to change the hostname of the URL. If the URL’s scheme is not hierarchical (which the URL standard calls “special schemes”), then it has no concept of a host and setting this property has no effect.

§Examples
https://developer.mozilla.org/en-US/docs/Web/API/URL/hostname
Yields: 'developer.mozilla.org

你好.com
Yields: 'xn--6qq79v.com
Source

pub fn host(&self) -> WasmToolkitResult<String>

The host property of the URL interface is a string containing the host, which is the hostname, and then, if the port of the URL is nonempty, a “:”, followed by the port of the URL. If the URL does not have a hostname, this property contains an empty string, “”.

This property can be set to change both the hostname and the port of the URL. If the URL’s scheme is not hierarchical (which the URL standard calls “special schemes”), then it has no concept of a host and setting this property has no effect.

Note: If the given value for the host setter lacks a port, the URL’s port will not change. This can be unexpected as the host getter does return a URL-port string, so one might have assumed the setter to always “reset” both.

§Examples
1. https://developer.mozilla.org/en-US/docs/Web/API/URL/host
"developer.mozilla.org"

2. https://developer.mozilla.org:443/en-US/docs/Web/API/URL/host
developer.mozilla.org #The port number is not included because 443 is the scheme's default port

3. https://developer.mozilla.org:4097/en-US/docs/Web/API/URL/host
developer.mozilla.org:4097
Source

pub fn origin(&self) -> WasmToolkitResult<String>

The origin read-only property of the Location interface returns a string containing the Unicode serialization of the origin of the location’s URL. It contains the scheme as the first part.

The port is only included if it’s not the default for the protocol.

§Example: ‘https://developer.mozilla.org’
Source

pub fn href(&self) -> WasmToolkitResult<String>

The href property of the Location interface is a stringifier that returns a string containing the whole URL, and allows the href to be updated. Setting the value of href navigates to the provided URL.

If you want redirection, use location.replace(). The difference from setting the href property value is that when using the location.replace() method, after navigating to the given URL, 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.

§Example

https://developer.mozilla.org/en-US/docs/Web/API/URL/href Yields: https://developer.mozilla.org/en-US/docs/Web/API/URL/href

Source

pub fn hash(&self) -> WasmToolkitResult<String>

The hash property of the URL interface is a string containing a “#” followed by the fragment identifier of the URL. If the URL does not have a fragment identifier, this property contains an empty string, “”.

This property can be set to change the fragment identifier of the URL. When setting, a single “#” prefix is added to the provided value, if not already present. Setting it to “” removes the fragment identifier.

The fragment is percent-encoded when setting but not percent-decoded when reading.

Source

pub fn navigator(&self) -> Navigator

Source

pub fn language(&self) -> WasmToolkitResult<String>

Source§

impl WasmWindow

Source§

impl WasmWindow

Source

pub fn new() -> WasmToolkitResult<Self>

Source

pub fn inner(&self) -> &Window

Source

pub fn clone_window(&self) -> Window

Trait Implementations§

Source§

impl Clone for WasmWindow

Source§

fn clone(&self) -> WasmWindow

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WasmWindow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for WasmWindow

Source§

fn eq(&self, other: &WasmWindow) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for WasmWindow

Source§

impl StructuralPartialEq for WasmWindow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.