Trait TryFromUri

Source
pub trait TryFromUri: Sized {
    // Required method
    fn build_with_base_uri(uri: Uri) -> Self;

    // Provided methods
    fn from_str(uri: &str) -> Result<Self, InvalidUri> { ... }
    fn from_host_and_port(
        scheme: Scheme,
        host: &str,
        port: u16,
    ) -> Result<Self, Error> { ... }
    fn from_ipv4(scheme: Scheme, addr: SocketAddrV4) -> Result<Self, Error> { ... }
    fn from_ipv6(scheme: Scheme, addr: SocketAddrV6) -> Result<Self, Error> { ... }
    fn from_socket(
        scheme: Scheme,
        socket_addr: SocketAddr,
    ) -> Result<Self, Error> { ... }
    fn from_multiaddr(multiaddr: Multiaddr) -> Result<Self, Error> { ... }
    fn from_multiaddr_str(multiaddr: &str) -> Result<Self, Error> { ... }
    fn from_ipfs_config() -> Option<Self> { ... }
}

Required Methods§

Source

fn build_with_base_uri(uri: Uri) -> Self

Builds a new client from a base URI to the IPFS API.

Provided Methods§

Source

fn from_str(uri: &str) -> Result<Self, InvalidUri>

Creates a new client from a str.

Note: This constructor will overwrite the path/query part of the URI.

Source

fn from_host_and_port( scheme: Scheme, host: &str, port: u16, ) -> Result<Self, Error>

Creates a new client from a host name and port.

Source

fn from_ipv4(scheme: Scheme, addr: SocketAddrV4) -> Result<Self, Error>

Creates a new client from an IPV4 address and port number.

Source

fn from_ipv6(scheme: Scheme, addr: SocketAddrV6) -> Result<Self, Error>

Creates a new client from an IPV6 addr and port number.

Source

fn from_socket(scheme: Scheme, socket_addr: SocketAddr) -> Result<Self, Error>

Creates a new client from an IP address and port number.

Source

fn from_multiaddr(multiaddr: Multiaddr) -> Result<Self, Error>

Creates a new client from a multiaddr.

Source

fn from_multiaddr_str(multiaddr: &str) -> Result<Self, Error>

Creates a new client from a multiaddr.

Source

fn from_ipfs_config() -> Option<Self>

Creates a new client connected to the endpoint specified in ~/.ipfs/api.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§