Struct enr::Builder

source ·
pub struct Builder<K: EnrKey> { /* private fields */ }
Expand description

The base builder for generating ENR records with arbitrary signing algorithms.

Implementations§

source§

impl<K: EnrKey> Builder<K>

source

pub fn seq(&mut self, seq: u64) -> &mut Self

Modifies the sequence number of the builder.

source

pub fn add_value<T: Encodable>( &mut self, key: impl AsRef<[u8]>, value: &T, ) -> &mut Self

Adds an arbitrary key-value to the ENRBuilder.

source

pub fn add_value_rlp(&mut self, key: impl AsRef<[u8]>, rlp: Bytes) -> &mut Self

Adds an arbitrary key-value where the value is raw RLP encoded bytes.

source

pub fn ip(&mut self, ip: IpAddr) -> &mut Self

Adds an ip/ip6 field to the ENRBuilder.

source

pub fn ip4(&mut self, ip: Ipv4Addr) -> &mut Self

Adds an ip field to the ENRBuilder.

source

pub fn ip6(&mut self, ip: Ipv6Addr) -> &mut Self

Adds an ip6 field to the ENRBuilder.

source

pub fn tcp4(&mut self, tcp: u16) -> &mut Self

Adds a tcp field to the ENRBuilder.

source

pub fn tcp6(&mut self, tcp: u16) -> &mut Self

Adds a tcp6 field to the ENRBuilder.

source

pub fn udp4(&mut self, udp: u16) -> &mut Self

Adds a udp field to the ENRBuilder.

source

pub fn udp6(&mut self, udp: u16) -> &mut Self

Adds a udp6 field to the ENRBuilder.

source

pub fn client_info( &mut self, name: String, version: String, build: Option<String>, ) -> &mut Self

Adds a EIP-7636 client field to the ENRBuilder.

source

pub fn build(&mut self, key: &K) -> Result<Enr<K>, Error>

Constructs an ENR from the Builder.

§Errors

Fails if the identity scheme is not supported, or the record size exceeds MAX_ENR_SIZE.

Trait Implementations§

source§

impl<K: EnrKey> Default for Builder<K>

source§

fn default() -> Self

Constructs a minimal Builder for the v4 identity scheme.

Auto Trait Implementations§

§

impl<K> Freeze for Builder<K>

§

impl<K> RefUnwindSafe for Builder<K>
where K: RefUnwindSafe,

§

impl<K> Send for Builder<K>

§

impl<K> Sync for Builder<K>

§

impl<K> Unpin for Builder<K>

§

impl<K> UnwindSafe for Builder<K>
where K: UnwindSafe,

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V