Struct comm::address::Address [] [src]

pub struct Address { /* fields omitted */ }

An Address can be used to address anything that is Addressable. Nodes, for example, have an Address. Every client::messages::TextMessage has an Address as well.

Methods

impl Address
[src]

[src]

Hashes content into an Address. Current implementation is to take the SHA1 digest of content, but this is subject to change and should not be depended on.

Example

use comm::address;

let addr = address::Address::for_content("alep");
let addr_from_str = address::Address::from_str("44751799925b964a00bae3863cc4236f9bb8d519").unwrap();
assert_eq!(addr, addr_from_str);

[src]

Creates an Address from its numeric representation. Useful for randomly generating Addresses within a range.

[src]

Creates a Address from its hexidecimal string representation. string must be hexidecimal or an Err will be returned.

[src]

The null Address. Use to address "nothing." No Node, message, or any Addressable thing should ever reside at the null address. It's useful for bootstrapping a network::Network when one does not know the address of any peers, but has connection details to them such as an IP address and port.

[src]

Randomly generates an Address within the address space between min and max. Useful for refreshing a NodeBucket by performing a find node operation on a random address within its range.

[src]

The numeric representation of an Address. Useful for partitioning the Nodes in a NodeBucket into two new buckets.

[src]

The address space distance of self from other. Computed as the XOR of their numeric representations.

[src]

The string representation of an Address. Useful for displaying, exporting outside of Rust, serializing into a protobuf, etc.

TODO: this may be poorly named, breaking the to_string convention set by &str::to_string. It's probably wiser to impl ToString.

Trait Implementations

impl Clone for Address
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Address
[src]

impl Eq for Address
[src]

impl Hash for Address
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialEq for Address
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Debug for Address
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for Address
[src]

[src]

Formats the value using the given formatter. Read more