pub fn new(
        legacy: RegisteredProtocol,
        list: impl Into<Vec<(Cow<'static, str>, Arc<RwLock<Vec<u8>>>)>>,
    ) -> Self {
        let list = list.into();
        assert!(!list.is_empty());

        let out_handlers = list
            .clone()
            .into_iter()
            .map(|(proto_name, initial_message)| {
                (NotifsOutHandlerProto::new(proto_name), initial_message)
            })
            .collect();

        let in_handlers = list
            .clone()
            .into_iter()
            .map(|(proto_name, msg)| (NotifsInHandlerProto::new(proto_name), msg))
            .collect();

        NotifsHandlerProto {
            in_handlers,
            out_handlers,
            legacy: LegacyProtoHandlerProto::new(legacy),
        }
    }
/// Builds a new handler.
///
/// `list` is a list of notification protocols names, and the message to send as part of the
/// handshake. At the moment, the message is always the same whether we open a substream
/// ourselves or respond to handshake from the remote.
///
/// The first protocol in `list` is special-cased as the protocol that contains the handshake
/// to report through the [`NotifsHandlerOut::Open`] event.
///
/// # Panic
///
/// - Panics if `list` is empty.
///
Builds a new handler.
`list` is a list of notification protocols names, and the message to send as part of the
handshake. At the moment, the message is always the same whether we open a substream
ourselves or respond to handshake from the remote.

The first protocol in `list` is special-cased as the protocol that contains the handshake
to report through the [`NotifsHandlerOut::Open`] event.
Builds a new handler . ` list ` is a list of notification protocols names and the message to send as part of the handshake . At the moment the message is always the same whether we open a substream ourselves or respond to handshake from the remote . The first protocol in ` list ` is special - cased as the protocol that contains the handshake to report through the [ ` NotifsHandlerOut :: Open ` ] event .
pub fn new(
        legacy: RegisteredProtocol,
        list: impl Into<Vec<(Cow<'static, str>, Arc<RwLock<Vec<u8>>>)>>,
    ) -> Self {
        let list = list.into();
        assert!(!list.is_empty());
        let out_handlers = list
            .clone()
            .into_iter()
            .map(|(proto_name, initial_message)| {
                (NotifsOutHandlerProto::new(proto_name), initial_message)
            })
            .collect();
        let in_handlers = list
            .clone()
            .into_iter()
            .map(|(proto_name, msg)| (NotifsInHandlerProto::new(proto_name), msg))
            .collect();
        NotifsHandlerProto {
            in_handlers,
            out_handlers,
            legacy: LegacyProtoHandlerProto::new(legacy),
        }
    }
pub fn new ( legacy : RegisteredProtocol , list : impl Into < Vec < ( Cow < ' static , str > , Arc < RwLock < Vec < u8 > > > ) > > , ) -> Self { let list = list . into ( ) ; assert ! ( list is_empty ( ) ) ; let out_handlers = list . clone ( ) . into_iter ( ) . map ( | ( proto_name , initial_message ) | { ( NotifsOutHandlerProto :: new ( proto_name ) , initial_message ) } ) . collect ( ) ; let in_handlers = list . clone ( ) . into_iter ( ) . map ( | ( proto_name , msg ) | ( NotifsInHandlerProto :: new ( proto_name ) , msg ) ) . collect ( ) ; NotifsHandlerProto { in_handlers , out_handlers , legacy : LegacyProtoHandlerProto :: new ( legacy ) , } }
Builds a new handler.
Builds a new handler .
legacy
RegisteredProtocol
list
impl Into<Vec<(Cow<'static, str>, Arc<RwLock<Vec<u8>>>)>>
legacy
RegisteredProtocol
list
impl Into<Vec<(Cow<'static, str>, Arc<RwLock<Vec<u8>>>)>>
panic
Panics if `list` is empty.
Panics if ` list ` is empty .