pub struct RiceAddress(/* private fields */);Expand description
A socket address.
Implementations§
Source§impl RiceAddress
impl RiceAddress
Sourcepub fn new(addr: SocketAddr) -> Self
pub fn new(addr: SocketAddr) -> Self
Create a new RiceAddress.
Sourcepub fn into_c_full(self) -> *const RiceAddress
pub fn into_c_full(self) -> *const RiceAddress
Convert this RiceAddress into it’s C API equivalent.
The returned value should be converted back into the Rust equivalent using
RiceAddress::into_rust_full() in order to free the resource.
Sourcepub unsafe fn into_rice_full(value: *const RiceAddress) -> Box<Self>
pub unsafe fn into_rice_full(value: *const RiceAddress) -> Box<Self>
Consume a C representation of a RiceAddress into the Rust equivalent.
Sourcepub unsafe fn into_rice_none(value: *const RiceAddress) -> Self
pub unsafe fn into_rice_none(value: *const RiceAddress) -> Self
Copy a C representation of a RiceAddress into the Rust equivalent.
Sourcepub fn inner(self) -> SocketAddr
pub fn inner(self) -> SocketAddr
The inner representation of the RiceAddress.
Methods from Deref<Target = SocketAddr>§
1.7.0pub fn ip(&self) -> IpAddr
pub fn ip(&self) -> IpAddr
Returns the IP address associated with this socket address.
§Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));1.0.0pub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the port number associated with this socket address.
§Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
assert_eq!(socket.port(), 8080);1.16.0pub fn is_ipv4(&self) -> bool
pub fn is_ipv4(&self) -> bool
Returns true if the IP address in this SocketAddr is an
IPv4 address, and false otherwise.
§Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
assert_eq!(socket.is_ipv4(), true);
assert_eq!(socket.is_ipv6(), false);1.16.0pub fn is_ipv6(&self) -> bool
pub fn is_ipv6(&self) -> bool
Returns true if the IP address in this SocketAddr is an
IPv6 address, and false otherwise.
§Examples
use std::net::{IpAddr, Ipv6Addr, SocketAddr};
let socket = SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 65535, 0, 1)), 8080);
assert_eq!(socket.is_ipv4(), false);
assert_eq!(socket.is_ipv6(), true);Trait Implementations§
Source§impl Clone for RiceAddress
impl Clone for RiceAddress
Source§fn clone(&self) -> RiceAddress
fn clone(&self) -> RiceAddress
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RiceAddress
impl Debug for RiceAddress
Source§impl Deref for RiceAddress
impl Deref for RiceAddress
Source§impl Ord for RiceAddress
impl Ord for RiceAddress
Source§impl PartialEq for RiceAddress
impl PartialEq for RiceAddress
Source§impl PartialOrd for RiceAddress
impl PartialOrd for RiceAddress
impl Copy for RiceAddress
impl Eq for RiceAddress
impl StructuralPartialEq for RiceAddress
Auto Trait Implementations§
impl Freeze for RiceAddress
impl RefUnwindSafe for RiceAddress
impl Send for RiceAddress
impl Sync for RiceAddress
impl Unpin for RiceAddress
impl UnwindSafe for RiceAddress
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)