Struct Register

Source
pub struct Register<O> {
    pub password: fn(&O) -> Option<Line<'static>>,
    pub username: fn(&O) -> User<'static>,
    pub user_p1: fn(&O) -> Arg<'static>,
    pub user_p2: fn(&O) -> Arg<'static>,
    pub realname: fn(&O) -> Line<'static>,
    pub nicks: fn(&O) -> Box<dyn NickGen>,
    pub caps: fn(&O) -> Box<dyn CapFn>,
    pub auth: fn(&O) -> (SaslQueue, bool),
}
Available on crate feature client only.
Expand description

Client logic for the connection registration process.

Consider using the register_as_bot(), register_as_client(), or register_as_custom() functions to instantiate one of these.

The handler returned by using this type signals completion over its channel. Most of the useful data about client registration is added to the client as shared state. In particular, connection statistics and the MOTD are NOT stored, and should be read using a different handler.

Fields§

§password: fn(&O) -> Option<Line<'static>>

Returns the server password, if any.

§username: fn(&O) -> User<'static>

Returns the username to use for connection.

§user_p1: fn(&O) -> Arg<'static>

Returns the value used for the first unused USER parameter.

For older IRC software, this parameter is not actually unusused. RFC1459 specifies that this should be the connecting system’s hostname, while RFC2812 specifies that this should be a decimal integer whose bits are used to set user modes on connection.

§user_p2: fn(&O) -> Arg<'static>

Returns the value used for the second unused USER parameter.

For older IRC software, this parameter is not actually unusused. RFC1459 specifies that this should be the name of the server being connected to.

§realname: fn(&O) -> Line<'static>

Returns the realname to use for connection.

§nicks: fn(&O) -> Box<dyn NickGen>

Creates a nick generator.

§caps: fn(&O) -> Box<dyn CapFn>

Returns a boxed CapFn that provides a set of capabilities to require, given a set of available capabilities.

These capabilities will be requested from the server, except for sts which is special-cased to never be requested, only checked for presence.

§auth: fn(&O) -> (SaslQueue, bool)

Returns a SaslQueue to attempt and whether to close the connection on non-authentication.

Implementations§

Source§

impl<O> Register<O>

Source

pub fn register_msgs( &self, opts: &O, sink: impl ClientMsgSink<'static>, ) -> (Nick<'static>, Option<Box<dyn NickGen>>)

Sends the initial burst of messages for connection registration. Also returns the nickname used and a generator for fallback nicknames.

§Errors

Errors only if retrieving the server password errors.

Source§

impl<O> Register<O>

Source

pub fn handler(&self, opts: &O, sink: impl ClientMsgSink<'static>) -> Handler

Sends the initial burst of messages for connection registration. Also returns a Handler to perform the rest of the connection registration.

Trait Implementations§

Source§

impl<O: Clone> Clone for Register<O>

Source§

fn clone(&self) -> Register<O>

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<'a, O> MakeHandler<&'a O> for &'a Register<O>

Source§

type Value = Result<(), HandlerError>

The type of values yielded by the handler.
Source§

type Error = Infallible

The type of errors that can result while creating the handler. Read more
Source§

type Receiver<Spec: ChannelSpec> = <Spec as ChannelSpec>::Oneshot<<&'a Register<O> as MakeHandler<&'a O>>::Value>

The type of the receiver half of the preferred channel type.
Source§

fn make_handler( self, _: &ClientState, queue: QueueEditGuard<'_>, opts: &'a O, ) -> Result<Box<dyn Handler<Value = Self::Value>>, Self::Error>

Converts T into a Handler and queues messages.
Source§

fn make_channel<Spec: ChannelSpec>( spec: &Spec, ) -> (Box<dyn Sender<Value = Self::Value> + Send>, Self::Receiver<Spec>)

Creates an instance of the preferred channel type for a given channel spec. Read more

Auto Trait Implementations§

§

impl<O> Freeze for Register<O>

§

impl<O> RefUnwindSafe for Register<O>

§

impl<O> Send for Register<O>

§

impl<O> Sync for Register<O>

§

impl<O> Unpin for Register<O>

§

impl<O> UnwindSafe for Register<O>

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more