text:
impl<'a> ::method::connection::CloseMethod<'a> for ::Qpid9_0 {
    type Payload = Close<'a>;
} // impl<'a> ::method::connection::CloseMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Close<'a> {
    reply_code: u16,
    reply_text: ::std::borrow::Cow<'a, str>,
    class_id: u16,
    method_id: u16,
} // struct Close<'a>

impl<'a> Close<'a> {
    pub fn new<R>(reply_code: u16, reply_text: R, class_id: u16, method_id: u16) -> Self
        where R: Into<::std::borrow::Cow<'a, str>>
    {
        Close {
            reply_code: reply_code,
            reply_text: reply_text.into(),
            class_id: class_id,
            method_id: method_id,
        } // Close
    } // fn new()
    impl_properties! {
(reply_code, set_reply_code) -> u16,
(reply_text, reply_text_mut, set_reply_text) -> Cow<str>,
(class_id, set_class_id) -> u16,
(method_id, set_method_id) -> u16,
} // impl_properties
} // impl<'a> Close<'a>
impl<'a> Default for Close<'a> {
    fn default() -> Self {
        Close::new(0, "", 0, 0)
    } // fn default()
} // impl Default for Close

impl<'a> ::Encodable for Close<'a> {
    fn encoded_size(&self) -> usize {
        6 + ::Encodable::encoded_size(&self.reply_text)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.reply_code, writer)); // reply_code
        try!(::Encodable::write_encoded_to(&self.reply_text, writer)); // reply_text
        try!(::Encodable::write_encoded_to(&self.class_id, writer)); // class_id
        try!(::Encodable::write_encoded_to(&self.method_id, writer)); // method_id

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_close_encodable_bytes_written_matches_len() {
    let payload: Close = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for Close<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        50
    }
    fn method_name(&self) -> &'static str {
        "close"
    }
} // impl ::ProtocolMethodPayload for Close<'a>
impl<'a> ::method::connection::SetCloseMethodFields<'a> for Close<'a> {
    fn set_reply_code(&mut self, reply_code: u16) {
        self.set_reply_code(reply_code)
    } // set_reply_code()
    fn set_reply_text<V>(&mut self, reply_text: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_reply_text(reply_text.into())
    } // set_reply_text()
    fn set_class_id(&mut self, class_id: u16) {
        self.set_class_id(class_id)
    } // set_class_id()
    fn set_method_id(&mut self, method_id: u16) {
        self.set_method_id(method_id)
    } // set_method_id()
} // impl<'a> ::method::connection::SetCloseMethodFields<'a> for Close<'a>
impl<'a> From<Close<'a>> for ClassMethod<'a> {
    fn from(from: Close<'a>) -> Self {
        ClassMethod::Close(from)
    } // fn from()
} // impl From<Close<'a>> for ClassMethod

impl<'a> From<Close<'a>> for super::SpecMethod<'a> {
    fn from(from: Close<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Close<'a>> for ::super::SpecMethod
impl ::method::connection::CloseOkMethod for ::Qpid9_0 {
    type Payload = CloseOk;
} // impl ::method::connection::CloseOkMethod for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct CloseOk;

impl CloseOk {
    pub fn new() -> Self {
        CloseOk
    } // fn new()
} // impl CloseOk
impl Default for CloseOk {
    fn default() -> Self {
        CloseOk::new()
    } // fn default()
} // impl Default for CloseOk

impl ::Encodable for CloseOk {
    fn encoded_size(&self) -> usize {
        0
    } // encoded_size
    fn write_encoded_to<W>(&self, _: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        ::std::result::Result::Ok(())
    }
} // impl Encodable

#[test]
fn test_close_ok_encodable_bytes_written_matches_len() {
    let payload: CloseOk = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl ::ProtocolMethodPayload for CloseOk {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        51
    }
    fn method_name(&self) -> &'static str {
        "close-ok"
    }
} // impl ::ProtocolMethodPayload for CloseOk
impl<'a> From<CloseOk> for ClassMethod<'a> {
    fn from(from: CloseOk) -> Self {
        ClassMethod::CloseOk(from)
    } // fn from()
} // impl From<CloseOk> for ClassMethod

impl From<CloseOk> for super::SpecMethod<'static> {
    fn from(from: CloseOk) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<CloseOk> for ::super::SpecMethod
impl<'a> ::method::connection::OpenMethod<'a> for ::Qpid9_0 {
    type Payload = Open<'a>;
} // impl<'a> ::method::connection::OpenMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Open<'a> {
    virtual_host: ::std::borrow::Cow<'a, str>,
    capabilities: ::std::borrow::Cow<'a, str>,
    insist: bool,
} // struct Open<'a>

impl<'a> Open<'a> {
    pub fn new<V, C>(virtual_host: V, capabilities: C, insist: bool) -> Self
        where V: Into<::std::borrow::Cow<'a, str>>,
              C: Into<::std::borrow::Cow<'a, str>>
    {
        Open {
            virtual_host: virtual_host.into(),
            capabilities: capabilities.into(),
            insist: insist,
        } // Open
    } // fn new()
    impl_properties! {
(virtual_host, virtual_host_mut, set_virtual_host) -> Cow<str>,
(capabilities, capabilities_mut, set_capabilities) -> Cow<str>,
(insist, set_insist) -> bool,
} // impl_properties
} // impl<'a> Open<'a>
impl<'a> Default for Open<'a> {
    fn default() -> Self {
        Open::new("", "", false)
    } // fn default()
} // impl Default for Open

impl<'a> ::Encodable for Open<'a> {
    fn encoded_size(&self) -> usize {
        1 + ::Encodable::encoded_size(&self.virtual_host) +
        ::Encodable::encoded_size(&self.capabilities)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.virtual_host, writer)); // virtual_host
        try!(::Encodable::write_encoded_to(&self.capabilities, writer)); // capabilities
        try!(::Encodable::write_encoded_to(&{
                                               let mut bits = ::bit_vec::BitVec::from_elem(8,
                                                                                false);
                                               bits.set(7, self.insist);
                                               bits
                                           },
                                           writer));

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_open_encodable_bytes_written_matches_len() {
    let payload: Open = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for Open<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        40
    }
    fn method_name(&self) -> &'static str {
        "open"
    }
} // impl ::ProtocolMethodPayload for Open<'a>
impl<'a> ::method::connection::SetOpenMethodFields<'a> for Open<'a> {
    fn set_virtual_host<V>(&mut self, virtual_host: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_virtual_host(virtual_host.into())
    } // set_virtual_host()
    fn set_capabilities<V>(&mut self, capabilities: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_capabilities(capabilities.into())
    } // set_capabilities()
    fn set_insist(&mut self, insist: bool) {
        self.set_insist(insist)
    } // set_insist()
} // impl<'a> ::method::connection::SetOpenMethodFields<'a> for Open<'a>
impl<'a> From<Open<'a>> for ClassMethod<'a> {
    fn from(from: Open<'a>) -> Self {
        ClassMethod::Open(from)
    } // fn from()
} // impl From<Open<'a>> for ClassMethod

impl<'a> From<Open<'a>> for super::SpecMethod<'a> {
    fn from(from: Open<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Open<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::OpenOkMethod<'a> for ::Qpid9_0 {
    type Payload = OpenOk<'a>;
} // impl<'a> ::method::connection::OpenOkMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct OpenOk<'a> {
    known_hosts: ::std::borrow::Cow<'a, str>,
} // struct OpenOk<'a>

impl<'a> OpenOk<'a> {
    pub fn new<K>(known_hosts: K) -> Self
        where K: Into<::std::borrow::Cow<'a, str>>
    {
        OpenOk { known_hosts: known_hosts.into() } // OpenOk
    } // fn new()
    impl_properties! {
(known_hosts, known_hosts_mut, set_known_hosts) -> Cow<str>,
} // impl_properties
} // impl<'a> OpenOk<'a>
impl<'a> Default for OpenOk<'a> {
    fn default() -> Self {
        OpenOk::new("")
    } // fn default()
} // impl Default for OpenOk

impl<'a> ::Encodable for OpenOk<'a> {
    fn encoded_size(&self) -> usize {
        0 + ::Encodable::encoded_size(&self.known_hosts)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.known_hosts, writer)); // known_hosts

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_open_ok_encodable_bytes_written_matches_len() {
    let payload: OpenOk = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for OpenOk<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        41
    }
    fn method_name(&self) -> &'static str {
        "open-ok"
    }
} // impl ::ProtocolMethodPayload for OpenOk<'a>
impl<'a> ::method::connection::SetOpenOkMethodFields<'a> for OpenOk<'a> {
    fn set_known_hosts<V>(&mut self, known_hosts: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_known_hosts(known_hosts.into())
    } // set_known_hosts()
} // impl<'a> ::method::connection::SetOpenOkMethodFields<'a> for OpenOk<'a>
impl<'a> From<OpenOk<'a>> for ClassMethod<'a> {
    fn from(from: OpenOk<'a>) -> Self {
        ClassMethod::OpenOk(from)
    } // fn from()
} // impl From<OpenOk<'a>> for ClassMethod

impl<'a> From<OpenOk<'a>> for super::SpecMethod<'a> {
    fn from(from: OpenOk<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<OpenOk<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::RedirectMethod<'a> for ::Qpid9_0 {
    type Payload = Redirect<'a>;
} // impl<'a> ::method::connection::RedirectMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Redirect<'a> {
    host: ::std::borrow::Cow<'a, str>,
    known_hosts: ::std::borrow::Cow<'a, str>,
} // struct Redirect<'a>

impl<'a> Redirect<'a> {
    pub fn new<H, K>(host: H, known_hosts: K) -> Self
        where H: Into<::std::borrow::Cow<'a, str>>,
              K: Into<::std::borrow::Cow<'a, str>>
    {
        Redirect {
            host: host.into(),
            known_hosts: known_hosts.into(),
        } // Redirect
    } // fn new()
    impl_properties! {
(host, host_mut, set_host) -> Cow<str>,
(known_hosts, known_hosts_mut, set_known_hosts) -> Cow<str>,
} // impl_properties
} // impl<'a> Redirect<'a>
impl<'a> Default for Redirect<'a> {
    fn default() -> Self {
        Redirect::new("", "")
    } // fn default()
} // impl Default for Redirect

impl<'a> ::Encodable for Redirect<'a> {
    fn encoded_size(&self) -> usize {
        0 + ::Encodable::encoded_size(&self.host) + ::Encodable::encoded_size(&self.known_hosts)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.host, writer)); // host
        try!(::Encodable::write_encoded_to(&self.known_hosts, writer)); // known_hosts

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_redirect_encodable_bytes_written_matches_len() {
    let payload: Redirect = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for Redirect<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        42
    }
    fn method_name(&self) -> &'static str {
        "redirect"
    }
} // impl ::ProtocolMethodPayload for Redirect<'a>
impl<'a> ::method::connection::SetRedirectMethodFields<'a> for Redirect<'a> {
    fn set_host<V>(&mut self, host: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_host(host.into())
    } // set_host()
    fn set_known_hosts<V>(&mut self, known_hosts: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_known_hosts(known_hosts.into())
    } // set_known_hosts()
} // impl<'a> ::method::connection::SetRedirectMethodFields<'a> for Redirect<'a>
impl<'a> From<Redirect<'a>> for ClassMethod<'a> {
    fn from(from: Redirect<'a>) -> Self {
        ClassMethod::Redirect(from)
    } // fn from()
} // impl From<Redirect<'a>> for ClassMethod

impl<'a> From<Redirect<'a>> for super::SpecMethod<'a> {
    fn from(from: Redirect<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Redirect<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::SecureMethod<'a> for ::Qpid9_0 {
    type Payload = Secure<'a>;
} // impl<'a> ::method::connection::SecureMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Secure<'a> {
    challenge: ::std::borrow::Cow<'a, [u8]>,
} // struct Secure<'a>

impl<'a> Secure<'a> {
    pub fn new<C>(challenge: C) -> Self
        where C: Into<::std::borrow::Cow<'a, [u8]>>
    {
        Secure { challenge: challenge.into() } // Secure
    } // fn new()
    impl_properties! {
(challenge, challenge_mut, set_challenge) -> Cow<[u8]>,
} // impl_properties
} // impl<'a> Secure<'a>
impl<'a> Default for Secure<'a> {
    fn default() -> Self {
        Secure::new(&[][..])
    } // fn default()
} // impl Default for Secure

impl<'a> ::Encodable for Secure<'a> {
    fn encoded_size(&self) -> usize {
        0 + ::Encodable::encoded_size(&self.challenge)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.challenge, writer)); // challenge

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_secure_encodable_bytes_written_matches_len() {
    let payload: Secure = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for Secure<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        20
    }
    fn method_name(&self) -> &'static str {
        "secure"
    }
} // impl ::ProtocolMethodPayload for Secure<'a>
impl<'a> ::method::connection::SetSecureMethodFields<'a> for Secure<'a> {
    fn set_challenge<V>(&mut self, challenge: V)
        where V: Into<::std::borrow::Cow<'a, [u8]>>
    {
        self.set_challenge(challenge.into())
    } // set_challenge()
} // impl<'a> ::method::connection::SetSecureMethodFields<'a> for Secure<'a>
impl<'a> From<Secure<'a>> for ClassMethod<'a> {
    fn from(from: Secure<'a>) -> Self {
        ClassMethod::Secure(from)
    } // fn from()
} // impl From<Secure<'a>> for ClassMethod

impl<'a> From<Secure<'a>> for super::SpecMethod<'a> {
    fn from(from: Secure<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Secure<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::SecureOkMethod<'a> for ::Qpid9_0 {
    type Payload = SecureOk<'a>;
} // impl<'a> ::method::connection::SecureOkMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct SecureOk<'a> {
    response: ::std::borrow::Cow<'a, [u8]>,
} // struct SecureOk<'a>

impl<'a> SecureOk<'a> {
    pub fn new<R>(response: R) -> Self
        where R: Into<::std::borrow::Cow<'a, [u8]>>
    {
        SecureOk { response: response.into() } // SecureOk
    } // fn new()
    impl_properties! {
(response, response_mut, set_response) -> Cow<[u8]>,
} // impl_properties
} // impl<'a> SecureOk<'a>
impl<'a> Default for SecureOk<'a> {
    fn default() -> Self {
        SecureOk::new(&[][..])
    } // fn default()
} // impl Default for SecureOk

impl<'a> ::Encodable for SecureOk<'a> {
    fn encoded_size(&self) -> usize {
        0 + ::Encodable::encoded_size(&self.response)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.response, writer)); // response

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_secure_ok_encodable_bytes_written_matches_len() {
    let payload: SecureOk = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for SecureOk<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        21
    }
    fn method_name(&self) -> &'static str {
        "secure-ok"
    }
} // impl ::ProtocolMethodPayload for SecureOk<'a>
impl<'a> ::method::connection::SetSecureOkMethodFields<'a> for SecureOk<'a> {
    fn set_response<V>(&mut self, response: V)
        where V: Into<::std::borrow::Cow<'a, [u8]>>
    {
        self.set_response(response.into())
    } // set_response()
} // impl<'a> ::method::connection::SetSecureOkMethodFields<'a> for SecureOk<'a>
impl<'a> From<SecureOk<'a>> for ClassMethod<'a> {
    fn from(from: SecureOk<'a>) -> Self {
        ClassMethod::SecureOk(from)
    } // fn from()
} // impl From<SecureOk<'a>> for ClassMethod

impl<'a> From<SecureOk<'a>> for super::SpecMethod<'a> {
    fn from(from: SecureOk<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<SecureOk<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::StartMethod<'a> for ::Qpid9_0 {
    type Payload = Start<'a>;
} // impl<'a> ::method::connection::StartMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Start<'a> {
    version_major: u8,
    version_minor: u8,
    server_properties: ::field::TableEntries<'a>,
    mechanisms: ::std::borrow::Cow<'a, [u8]>,
    locales: ::std::borrow::Cow<'a, [u8]>,
} // struct Start<'a>

impl<'a> Start<'a> {
    pub fn new<S, M, L>(version_major: u8,
                        version_minor: u8,
                        server_properties: S,
                        mechanisms: M,
                        locales: L)
                        -> Self
        where S: Into<::field::TableEntries<'a>>,
              M: Into<::std::borrow::Cow<'a, [u8]>>,
              L: Into<::std::borrow::Cow<'a, [u8]>>
    {
        Start {
            version_major: version_major,
            version_minor: version_minor,
            server_properties: server_properties.into(),
            mechanisms: mechanisms.into(),
            locales: locales.into(),
        } // Start
    } // fn new()
    impl_properties! {
(version_major, set_version_major) -> u8,
(version_minor, set_version_minor) -> u8,
(server_properties, server_properties_mut, set_server_properties) -> &::field::TableEntries<'a>,
(mechanisms, mechanisms_mut, set_mechanisms) -> Cow<[u8]>,
(locales, locales_mut, set_locales) -> Cow<[u8]>,
} // impl_properties
} // impl<'a> Start<'a>
impl<'a> Default for Start<'a> {
    fn default() -> Self {
        Start::new(0, 0, ::field::TableEntries::new(), &[][..], &[][..])
    } // fn default()
} // impl Default for Start

impl<'a> ::Encodable for Start<'a> {
    fn encoded_size(&self) -> usize {
        2 + ::Encodable::encoded_size(&self.server_properties) +
        ::Encodable::encoded_size(&self.mechanisms) +
        ::Encodable::encoded_size(&self.locales)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.version_major, writer)); // version_major
        try!(::Encodable::write_encoded_to(&self.version_minor, writer)); // version_minor
        try!(::Encodable::write_encoded_to(&self.server_properties, writer)); // server_properties
        try!(::Encodable::write_encoded_to(&self.mechanisms, writer)); // mechanisms
        try!(::Encodable::write_encoded_to(&self.locales, writer)); // locales

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_start_encodable_bytes_written_matches_len() {
    let payload: Start = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for Start<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        10
    }
    fn method_name(&self) -> &'static str {
        "start"
    }
} // impl ::ProtocolMethodPayload for Start<'a>
impl<'a> ::method::connection::SetStartMethodFields<'a> for Start<'a> {
    fn set_version_major(&mut self, version_major: u8) {
        self.set_version_major(version_major)
    } // set_version_major()
    fn set_version_minor(&mut self, version_minor: u8) {
        self.set_version_minor(version_minor)
    } // set_version_minor()
    fn set_server_properties<V>(&mut self, server_properties: V)
        where V: Into<::field::TableEntries<'a>>
    {
        self.set_server_properties(server_properties.into())
    } // set_server_properties()
    fn set_mechanisms<V>(&mut self, mechanisms: V)
        where V: Into<::std::borrow::Cow<'a, [u8]>>
    {
        self.set_mechanisms(mechanisms.into())
    } // set_mechanisms()
    fn set_locales<V>(&mut self, locales: V)
        where V: Into<::std::borrow::Cow<'a, [u8]>>
    {
        self.set_locales(locales.into())
    } // set_locales()
} // impl<'a> ::method::connection::SetStartMethodFields<'a> for Start<'a>
impl<'a> From<Start<'a>> for ClassMethod<'a> {
    fn from(from: Start<'a>) -> Self {
        ClassMethod::Start(from)
    } // fn from()
} // impl From<Start<'a>> for ClassMethod

impl<'a> From<Start<'a>> for super::SpecMethod<'a> {
    fn from(from: Start<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Start<'a>> for ::super::SpecMethod
impl<'a> ::method::connection::StartOkMethod<'a> for ::Qpid9_0 {
    type Payload = StartOk<'a>;
} // impl<'a> ::method::connection::StartOkMethod<'a> for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct StartOk<'a> {
    client_properties: ::field::TableEntries<'a>,
    mechanism: ::std::borrow::Cow<'a, str>,
    response: ::std::borrow::Cow<'a, [u8]>,
    locale: ::std::borrow::Cow<'a, str>,
} // struct StartOk<'a>

impl<'a> StartOk<'a> {
    pub fn new<C, M, R, L>(client_properties: C, mechanism: M, response: R, locale: L) -> Self
        where C: Into<::field::TableEntries<'a>>,
              M: Into<::std::borrow::Cow<'a, str>>,
              R: Into<::std::borrow::Cow<'a, [u8]>>,
              L: Into<::std::borrow::Cow<'a, str>>
    {
        StartOk {
            client_properties: client_properties.into(),
            mechanism: mechanism.into(),
            response: response.into(),
            locale: locale.into(),
        } // StartOk
    } // fn new()
    impl_properties! {
(client_properties, client_properties_mut, set_client_properties) -> &::field::TableEntries<'a>,
(mechanism, mechanism_mut, set_mechanism) -> Cow<str>,
(response, response_mut, set_response) -> Cow<[u8]>,
(locale, locale_mut, set_locale) -> Cow<str>,
} // impl_properties
} // impl<'a> StartOk<'a>
impl<'a> Default for StartOk<'a> {
    fn default() -> Self {
        StartOk::new(::field::TableEntries::new(), "", &[][..], "")
    } // fn default()
} // impl Default for StartOk

impl<'a> ::Encodable for StartOk<'a> {
    fn encoded_size(&self) -> usize {
        0 + ::Encodable::encoded_size(&self.client_properties) +
        ::Encodable::encoded_size(&self.mechanism) +
        ::Encodable::encoded_size(&self.response) + ::Encodable::encoded_size(&self.locale)
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.client_properties, writer)); // client_properties
        try!(::Encodable::write_encoded_to(&self.mechanism, writer)); // mechanism
        try!(::Encodable::write_encoded_to(&self.response, writer)); // response
        try!(::Encodable::write_encoded_to(&self.locale, writer)); // locale

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_start_ok_encodable_bytes_written_matches_len() {
    let payload: StartOk = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl<'a> ::ProtocolMethodPayload for StartOk<'a> {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        11
    }
    fn method_name(&self) -> &'static str {
        "start-ok"
    }
} // impl ::ProtocolMethodPayload for StartOk<'a>
impl<'a> ::method::connection::SetStartOkMethodFields<'a> for StartOk<'a> {
    fn set_client_properties<V>(&mut self, client_properties: V)
        where V: Into<::field::TableEntries<'a>>
    {
        self.set_client_properties(client_properties.into())
    } // set_client_properties()
    fn set_mechanism<V>(&mut self, mechanism: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_mechanism(mechanism.into())
    } // set_mechanism()
    fn set_response<V>(&mut self, response: V)
        where V: Into<::std::borrow::Cow<'a, [u8]>>
    {
        self.set_response(response.into())
    } // set_response()
    fn set_locale<V>(&mut self, locale: V)
        where V: Into<::std::borrow::Cow<'a, str>>
    {
        self.set_locale(locale.into())
    } // set_locale()
} // impl<'a> ::method::connection::SetStartOkMethodFields<'a> for StartOk<'a>
impl<'a> From<StartOk<'a>> for ClassMethod<'a> {
    fn from(from: StartOk<'a>) -> Self {
        ClassMethod::StartOk(from)
    } // fn from()
} // impl From<StartOk<'a>> for ClassMethod

impl<'a> From<StartOk<'a>> for super::SpecMethod<'a> {
    fn from(from: StartOk<'a>) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<StartOk<'a>> for ::super::SpecMethod
impl ::method::connection::TuneMethod for ::Qpid9_0 {
    type Payload = Tune;
} // impl ::method::connection::TuneMethod for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct Tune {
    channel_max: u16,
    frame_max: u32,
    heartbeat: u16,
} // struct Tune

impl Tune {
    pub fn new(channel_max: u16, frame_max: u32, heartbeat: u16) -> Self {
        Tune {
            channel_max: channel_max,
            frame_max: frame_max,
            heartbeat: heartbeat,
        } // Tune
    } // fn new()
    impl_properties! {
(channel_max, set_channel_max) -> u16,
(frame_max, set_frame_max) -> u32,
(heartbeat, set_heartbeat) -> u16,
} // impl_properties
} // impl Tune
impl Default for Tune {
    fn default() -> Self {
        Tune::new(0, 0, 0)
    } // fn default()
} // impl Default for Tune

impl ::Encodable for Tune {
    fn encoded_size(&self) -> usize {
        8
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.channel_max, writer)); // channel_max
        try!(::Encodable::write_encoded_to(&self.frame_max, writer)); // frame_max
        try!(::Encodable::write_encoded_to(&self.heartbeat, writer)); // heartbeat

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_tune_encodable_bytes_written_matches_len() {
    let payload: Tune = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl ::ProtocolMethodPayload for Tune {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        30
    }
    fn method_name(&self) -> &'static str {
        "tune"
    }
} // impl ::ProtocolMethodPayload for Tune
impl ::method::connection::SetTuneMethodFields for Tune {
    fn set_channel_max(&mut self, channel_max: u16) {
        self.set_channel_max(channel_max)
    } // set_channel_max()
    fn set_frame_max(&mut self, frame_max: u32) {
        self.set_frame_max(frame_max)
    } // set_frame_max()
    fn set_heartbeat(&mut self, heartbeat: u16) {
        self.set_heartbeat(heartbeat)
    } // set_heartbeat()
} // impl ::method::connection::SetTuneMethodFields for Tune
impl<'a> From<Tune> for ClassMethod<'a> {
    fn from(from: Tune) -> Self {
        ClassMethod::Tune(from)
    } // fn from()
} // impl From<Tune> for ClassMethod

impl From<Tune> for super::SpecMethod<'static> {
    fn from(from: Tune) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<Tune> for ::super::SpecMethod
impl ::method::connection::TuneOkMethod for ::Qpid9_0 {
    type Payload = TuneOk;
} // impl ::method::connection::TuneOkMethod for ::Qpid9_0

// generated by primalgen::codegen::spec-module::class_mod::method_struct
#[derive(Debug)]
pub struct TuneOk {
    channel_max: u16,
    frame_max: u32,
    heartbeat: u16,
} // struct TuneOk

impl TuneOk {
    pub fn new(channel_max: u16, frame_max: u32, heartbeat: u16) -> Self {
        TuneOk {
            channel_max: channel_max,
            frame_max: frame_max,
            heartbeat: heartbeat,
        } // TuneOk
    } // fn new()
    impl_properties! {
(channel_max, set_channel_max) -> u16,
(frame_max, set_frame_max) -> u32,
(heartbeat, set_heartbeat) -> u16,
} // impl_properties
} // impl TuneOk
impl Default for TuneOk {
    fn default() -> Self {
        TuneOk::new(0, 0, 0)
    } // fn default()
} // impl Default for TuneOk

impl ::Encodable for TuneOk {
    fn encoded_size(&self) -> usize {
        8
    } // encoded_size
    fn write_encoded_to<W>(&self, writer: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        try!(::Encodable::write_encoded_to(&self.channel_max, writer)); // channel_max
        try!(::Encodable::write_encoded_to(&self.frame_max, writer)); // frame_max
        try!(::Encodable::write_encoded_to(&self.heartbeat, writer)); // heartbeat

        ::std::result::Result::Ok(())
    } // fn write_encoded_to()
} // impl Encodable

#[test]
fn test_tune_ok_encodable_bytes_written_matches_len() {
    let payload: TuneOk = Default::default();
    let expected_len = ::Encodable::encoded_size(&payload);
    let mut writer = ::std::io::Cursor::new(Vec::with_capacity(expected_len));
    ::Encodable::write_encoded_to(&payload, &mut writer).unwrap();
    let payload = writer.into_inner();

    if payload.len() != expected_len {
        panic!("Expected payload len {}, got {}, {:?}",
               expected_len,
               payload.len(),
               &payload[..]);
    }
}

impl ::ProtocolMethodPayload for TuneOk {
    fn class(&self) -> ::Class {
        ::Class::Connection
    }
    fn class_id(&self) -> u16 {
        10
    }
    fn class_name(&self) -> &'static str {
        "connection"
    }
    fn method_id(&self) -> u16 {
        31
    }
    fn method_name(&self) -> &'static str {
        "tune-ok"
    }
} // impl ::ProtocolMethodPayload for TuneOk
impl ::method::connection::SetTuneOkMethodFields for TuneOk {
    fn set_channel_max(&mut self, channel_max: u16) {
        self.set_channel_max(channel_max)
    } // set_channel_max()
    fn set_frame_max(&mut self, frame_max: u32) {
        self.set_frame_max(frame_max)
    } // set_frame_max()
    fn set_heartbeat(&mut self, heartbeat: u16) {
        self.set_heartbeat(heartbeat)
    } // set_heartbeat()
} // impl ::method::connection::SetTuneOkMethodFields for TuneOk
impl<'a> From<TuneOk> for ClassMethod<'a> {
    fn from(from: TuneOk) -> Self {
        ClassMethod::TuneOk(from)
    } // fn from()
} // impl From<TuneOk> for ClassMethod

impl From<TuneOk> for super::SpecMethod<'static> {
    fn from(from: TuneOk) -> Self {
        super::SpecMethod::Connection(from.into())
    } // fn default()
} // impl From<TuneOk> for ::super::SpecMethod

#[derive(Debug)]
pub enum ClassMethod<'a> {
    Close(Close<'a>),
    CloseOk(CloseOk),
    Open(Open<'a>),
    OpenOk(OpenOk<'a>),
    Redirect(Redirect<'a>),
    Secure(Secure<'a>),
    SecureOk(SecureOk<'a>),
    Start(Start<'a>),
    StartOk(StartOk<'a>),
    Tune(Tune),
    TuneOk(TuneOk),
} // enum ClassMethod

impl<'a> ::Encodable for ClassMethod<'a> {
    fn encoded_size(&self) -> usize {
        match *self {
            ClassMethod::Close(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::CloseOk(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::Open(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::OpenOk(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::Redirect(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::Secure(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::SecureOk(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::Start(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::StartOk(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::Tune(ref method) => ::Encodable::encoded_size(method),
            ClassMethod::TuneOk(ref method) => ::Encodable::encoded_size(method),

        } // match *self

    } // fn encoded_size
    fn write_encoded_to<W>(&self, _: &mut W) -> ::std::io::Result<()>
        where W: ::std::io::Write
    {
        unimplemented!()
    } // fn write_encoded_to()
} // impl ::Encodable for ClassMethod<'a>

impl<'a> ::ProtocolMethodPayload for ClassMethod<'a> {
    fn class(&self) -> ::Class {
        match *self {
            ClassMethod::Close(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::CloseOk(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::Open(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::OpenOk(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::Redirect(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::Secure(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::SecureOk(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::Start(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::StartOk(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::Tune(ref method) => ::ProtocolMethodPayload::class(method),
            ClassMethod::TuneOk(ref method) => ::ProtocolMethodPayload::class(method),

        } // match *self

    } // fn class

    fn class_id(&self) -> u16 {
        match *self {
            ClassMethod::Close(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::CloseOk(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::Open(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::OpenOk(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::Redirect(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::Secure(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::SecureOk(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::Start(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::StartOk(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::Tune(ref method) => ::ProtocolMethodPayload::class_id(method),
            ClassMethod::TuneOk(ref method) => ::ProtocolMethodPayload::class_id(method),

        } // match *self

    } // fn class_id

    fn class_name(&self) -> &'static str {
        match *self {
            ClassMethod::Close(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::CloseOk(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::Open(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::OpenOk(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::Redirect(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::Secure(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::SecureOk(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::Start(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::StartOk(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::Tune(ref method) => ::ProtocolMethodPayload::class_name(method),
            ClassMethod::TuneOk(ref method) => ::ProtocolMethodPayload::class_name(method),

        } // match *self

    } // fn class_name

    fn method_id(&self) -> u16 {
        match *self {
            ClassMethod::Close(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::CloseOk(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::Open(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::OpenOk(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::Redirect(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::Secure(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::SecureOk(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::Start(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::StartOk(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::Tune(ref method) => ::ProtocolMethodPayload::method_id(method),
            ClassMethod::TuneOk(ref method) => ::ProtocolMethodPayload::method_id(method),

        } // match *self

    } // fn method_id

    fn method_name(&self) -> &'static str {
        match *self {
            ClassMethod::Close(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::CloseOk(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::Open(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::OpenOk(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::Redirect(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::Secure(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::SecureOk(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::Start(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::StartOk(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::Tune(ref method) => ::ProtocolMethodPayload::method_name(method),
            ClassMethod::TuneOk(ref method) => ::ProtocolMethodPayload::method_name(method),

        } // match *self

    } // fn method_name
} // impl ProtocolMethodPayload for ClassMethod


text:
description: This page explains common troubleshooting issues with the Login by Auth0 WordPress plugin.
toc: true
topics:
    - wordpress
    - cms
contentType: reference
useCase:
  - add-login
  - build-an-app
  - customize-connections
  - secure-an-api
  - manage-users
---
# Troubleshooting Login by Auth0

Here are some common troubleshooting questions. If the items below do not solve your issue, then consider the following alternatives:

* If you're setting up the plugin for the first time or having problems with users logging in, please review the [configuration](/cms/wordpress/configuration) page in this section.
* If you found a bug in the plugin code [submit an issue](https://github.com/auth0/wp-auth0/issues) or [create a pull request](https://github.com/auth0/wp-auth0/pulls) on GitHub.
* If you have questions about how to use Auth0 or the plugin, please [post on our community site](https://community.auth0.com/) or create a [support forum request here](https://wordpress.org/support/plugin/auth0).
* You can also see additional documentation and answers on our [support site](https://support.auth0.com/). Customers on a paid Auth0 plan can [submit a trouble ticket](https://support.auth0.com/tickets) for a fast response.

## I'm seeing the error message "Invalid state" that prevents me from logging in

State validation is a security feature added in [version 3.6.0](https://github.com/auth0/wp-auth0/releases/tag/3.6.0). A cached callback URL usually causes this error message (see your Application settings for the callback URLs that should not be cached). If this is not the issue or you need more information, please see [Troubleshoot WordPress Plugin Invalid State Errors](/cms/wordpress/invalid-state).

## I'm having an issue logging in or changing email/password using a custom database

[Please see our specific troubleshooting page](/cms/wordpress/user-migration#troubleshooting).

## I'm seeing the error message "Invalid ID token" or "Expired ID token" that prevents me from logging in

This is typically caused by a server set to an incorrect time. If the error message includes "used too early," then your server time is set in the future. If it says that the token is expired, then the server time is set too far in the past. A difference in time between two servers is common. Output `echo date(DateTime::ISO8601)` in PHP on your server and compare that, including seconds, to the current UTC time. If your server's time is more than 60 seconds (the default leeway) off from UTC time, then you'll need to set a longer leeway to account for your server's clock skew. You can paste the below code in your theme's `functions.php` or anywhere else that would run it after the plugin loads and before the login hook runs:

```
add_filter( 'auth0_jwt_leeway', function( $default_leeway ) { return 120; } );
```

This would provide a 120 second leeway. You may need to adjust this depending upon how skewed your server's time is.

## I see the error message "This account does not have an email associated..." that prevents me from logging in

If you get this error, make sure you are requesting an email from each provider in the Auth0 Dashboard under Connections -> Social (expand each provider). Take into account that not all providers return email addresses for users (e.g., Twitter). If this happens, you can always add an Email address to any logged in user through the Auth0 Dashboard (or API). See Users -> Edit.

For Connections that don't provide an `email_verified` flag (some Enterprise connections will not include this) *or* to skip this validation for specific Social Connections, add the strategy for that Connection in the "Skip Strategies" field. This field is located below the **Require Verified Email** switch accessible via **wp-admin** > **Auth0** > **Settings** > **Advanced**.

**This field should only be used if necessary because it circumvents the security precautions recommended Auth0.**

## I see the error message "There is a user with the same email" that prevents me from logging in

This means that there is a user in WordPress that has the same email as the one being used to login associated with a different Auth0 user. If you're in the process of testing the plugin or want to associate the existing user with the new Auth user instead:

1. Log in as an admin
1. Go to wp-admin > Users and search for the email being used
1. View the user's profile and scroll down to the bottom
1. Click **Delete Auth0 Data** and confirm

::: note
If you have 2 user accounts in Auth0 with the same email address, this error message will persist. We recommend looking into [user account linking](/users/concepts/overview-user-account-linking).
:::

## I see the error message "Failed cross origin authentication" or "No verifier returned from client" in my browser's console logs when trying to log in

Check your "Allowed Callback URLs" and "Allowed Origins (CORS)" fields in the [Application](${manage_url}/#/applications) settings for your WordPress site to make sure those are correct. If you're using a Chromium-based browser, see [Cross-Origin Authentication](/cross-origin-authentication#limitations) to make sure you don't have third-party cookies turned off.

## I need to rerun the Setup Wizard, but I don't see that menu option anymore.

This means that the plugin is already configured with a Domain, Client ID, and Client Secret. Running the Setup Wizard a second time can have unpredictable results. If you're setting up WordPress for the first time and want to start over before any logins have occurred:

1. Go to **wp-admin** > **Auth0** > **Settings** > **Basic**.
1. Delete the Domain and Client ID. Scroll down and click **Save Changes**.
1. Go to [Auth0 Dashboard > Applications](${manage_url}/#/applications)
1. Find the Application that was created by WordPress (its name should be the site name of your WordPress site)
1. Click on the Application to view its settings. Scroll to the bottom of the screen and click the **Delete Application** button.
1. Go to the [Auth0 Dashboard > Connections > Database](${manage_url}/#/connections/database)
1. Find the Connection that was created by WordPress (its name should be the site name of your WordPress site prepended with "DB-")
1. Click on the Connection to view the settings. Scroll down to the bottom, and click **I Want To Delete This Connection*. ***Please note that this will delete the Connection and all users that were created within.***
1. Return to WordPress. You will now see the Setup Wizard option under Auth0 in the admin menu.

## How do I setup Passwordless login?

<dfn data-key="passwordless">Passwordless</dfn> login is possible any Auth0-enabled website using email or SMS. To make this work on your WordPress site:

1. Turn on "Passwordless Login" from the plugin settings' **Features** tab and save
2. In your Auth0 dashboard, go to **[Connections > Passwordless](${manage_url}/#/connections/passwordless)**
  - To use email, turn on the **Email** connection and modify the settings if desired. This will turn on email code login (users are emailed a code which is then typed into the login form on your site).
  - To use a "magic link" (emailed link will automatically log users in), add `{passwordlessMethod: 'code'}` to the "Extra Settings" field in the plugin settings' **Advanced** tab.
  - To use SMS login, turn on the **SMS** connection and follow the steps to set up a Twilio developer account (this will require a paid Twilio account depending on usage).

The Auth0 login form will select a Passwordless method depending on which connection is activated above. If you have both connections active, it will default to email. In this case, either turn off the email connection to show SMS or add `sms` to the **Connections** field in the plugin settings' **Advanced** tab.

## I have two accounts for the same user in WordPress

Under some situations, you may end up with a user with two accounts. WordPress allows you to merge users by deleting one of the accounts and attributing that account's content to another user. Go to wp-admin > Users, select the account you want to remove, and in the confirmation dialog select another user to transfer the content.

## My configuration is wrong, and I can't authenticate using Auth0. Is there another way to access the plugin?

The plugin can be accessed using valid WordPress credentials through the regular WordPress login by adding `?wle` to the login URL. For example: `http://yourdomain.com/wp-login.php?wle`.

## I am having problems when a user logs in. Where can I find a log of what is happening?

The plugin provides an error log where you can check what has happened. Access it through the **Error Log** sub-item of the **Auth0** plugin menu. The [logs](${manage_url}/#/logs) in your Auth0 dashboard can also provide additional information.

## How can I show the widget or shortcode in signup mode by default?

You can use the widget `Extra configuration` setting (or the `extra_conf` attribute in the shortcode) and add this JSON `{"mode":"signup" }` that will force the plugin to be shown in this mode.

## When using a plugin to force the login, the user is not logged in

This is typically caused by a cached page after login. Check with your host for strategies to mitigate this or try adding a cache-busting parameter to the URL ([see this Gist for instructions](https://gist.github.com/joshcanhelp/e3eb693749f0fe66aad097c3bbb3b415)).

### The user is not logged in when using the "Force Login" plugin

This is because the callback URL has not been whitelisted. Try adding this code to the `my_forcelogin_whitelist` filter:

```php
function wp_auth0_forcelogin_whitelist( $whitelist ) {
  if ( ! empty( $_GET['auth0'] ) ) {
    $whitelist[] = site_url($_SERVER['REQUEST_URI']);
  }
  return $whitelist;
}
add_filter('v_forcelogin_whitelist', 'wp_auth0_forcelogin_whitelist', 10, 1);
```

## How can I redirect the users to a specific URL after login?

::: note
All redirects are checked using `wp_safe_redirect()` before being performed. If you're trying to redirect to a domain that is not your main domain, add that domain to the check using the core WordPress `allowed_redirect_hosts` filter ([documentation](https://developer.wordpress.org/reference/hooks/allowed_redirect_hosts/)).
:::

### On the login page

This plugin leverages WordPress features to work seamlessly with default settings. To add a redirect, you can append the `redirect_to` query parameter to the URL when you direct the user to the login page. The plugin will redirect the user to this URL after a successful login.

You can also use the **Login redirection URL** setting in the Auth0 plugin settings page. This will URL be used to redirect the user when the `redirect_to` parameter is not provided.

### Using the widget

The widget will automatically redirect to the same page where the user was before authentication. You can override this using the `Redirect after login:` setting.

### Using the shortcode

The shortcode will automatically redirect to the same page where the user was before authentication. You can override this using the `redirect_to` attribute.

## How can I migrate my WordPress users to Auth0?

The current version of the plugin does not provide a way to migrate users to Auth0 automatically, but you have a few options:

- The plugin exposes two endpoints to mark your custom database connection for **import to Auth0** mode as described in [Import users to Auth0](/connections/database/migrating). You can use these [plugin scripts](https://github.com/auth0/wp-auth0/blob/master/lib/WP_Auth0_CustomDBLib.php) to set up your connection.

- Export your user data to a JSON file and upload it for batch-import into Auth0. Initially, your users will have to reset their passwords when logging in using Auth0 because there is no way for Auth0 to decrypt the WordPress passwords during migration. To generate the JSON file, follow the instructions at [Mass-importing users to Auth0](/bulk-import). Then you will need to upload the file using the [Import users](/api/v2#!/Jobs/post_users_imports) endpoint.

- Use the [WordPress XML RPC](https://codex.wordpress.org/XML-RPC_Support) endpoint to setup the migration flow using a custom database connection as described in [Import users to Auth0](/connections/database/migrating) with [this script](https://gist.github.com/glena/b31716e3c8fe48927be2).

## The form_title setting is ignored when I set up the dict setting

Internally, the plugin uses the dict setting to change the Auth0 widget title. When you set up the dict field, it overrides the form_title one.

To change the form_title in this case, you need to add the following attribute to the dict JSON:

```json
{
    "signin": {
        "title": "The desired form title"
    }
}
```

## How can I modify the embedded Auth0 login form?

There are many options on the **Appearance** tab of the plugin settings page that can change the look and feel of the login form that is embedded on your site (`wp-login/php` page, shortcodes, or widgets). These options are covered on the [Configuration page](/cms/wordpress/configuration#appearance). This will not affect the the login form on the Auth0-hosted Universal Login Page.

There is also a field called "Extra Settings" on the **Advanced** tab that accepts a valid JSON object with all the settings you want to configure. This will override any changes made on the **Appearance** tab. For all the possible configuration options, please see our [documentation](/libraries/lock/v11/configuration).

To use custom styling or JavaScript with the embedded Auth0 login form, please see our [documentation here](https://auth0.com/docs/libraries/lock/v11/ui-customization#overriding-css). External style sheets and JS files should be loaded in your theme using the [`wp_enqueue_scripts`](https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/) hook for shortcodes/widgets and the [`login_enqueue_scripts`](https://developer.wordpress.org/reference/hooks/login_enqueue_scripts/) hook for `wp-login.php`.

## The session expires too soon

The Auth0 plugin does not handle sessions; it uses the WordPress settings. By default, user sessions are kept alive for two days. You can enable the `Remember users session` setting on the plugin settings' **Advanced** tab to allow sessions to remain live for up to 14 hours.

## How do I implement a Refresh Token?

We implemented additional parameters in the login methods used by the plugin to allow for <dfn data-key="refresh-token">Refresh Tokens</dfn>. Use the [`auth0_auth_scope`](/cms/wordpress/extending#auth0_auth_scope) filter combined with the [`auth0_user_login`](/cms/wordpress/extending#auth0_user_login) action to accomplish this.

## Profile data saved in WordPress is not being synced to the Auth0 user account.

This is a current limitation of the plugin but something we're looking at in a future release. The one exception to this is the user password. If the password is changed in WordPress and it passes the security policy set for the database connection being used, then that password will update for the Auth0 user as well. We'll be adding an error message in a future release to stop the process if the password is not strong enough.

## How do I migrate from "Social Login with Auth0" to "Login by Auth0"?

Historically, Auth0 has maintained two WordPress plugins:

- [Login by Auth0](https://wordpress.org/plugins/auth0/)
- [Social Login with Auth0](https://wordpress.org/plugins/social-login-with-auth0/)

These two plugins are effectively the same, but **Social Login with Auth** will not receive any updates past version 3.7.0 (released 13 August 2018). Migrating from **Social Login with Auth** to **Login by Auth0** is simple and won't result in any Auth0 or WordPress data loss.

::: note
Moving from **Social Login with Auth** to **Login by Auth0** will update the version number you see, so make sure to test this change out on a staging or development server first (just as you would if you were updating the plugin in wp-admin). Furthermore, logins may not work during the migration process, so be sure to use a maintenance mode plugin or complete the migration during off-peak hours.
:::

The easiest way to migrate is via (S)FTP:

1. Log in to the WordPress site as an administrator.
1. [Download Login by Auth0](https://downloads.wordpress.org/plugin/auth0.zip) and unzip it locally.
1. Deactivate the **Social Login with Auth0** plugin from the WordPress admin > Plugins screen.
1. Log in to the server you want to migrate to and navigate to `wp-content/plugins`.
1. Move the `social-login-with-auth0` folder out of the plugins folder to back up the contents.
1. Upload the new `auth0` plugin folder to the plugins directory.
1. Activate the new "Login by Auth0" plugin from the WordPress **Admin** > **Plugins** screen.

If you're unable to access the site via FTP, you can also run the process directly from the WordPress admin:

1. Log in to the WordPress site as an administrator.
1. Go to **Auth0** > **Import-Export Settings**.
1. Click **Export Settings**, then **Export**.
1. Deactivate the **Social Login with Auth0** plugin from the WordPress **Admin** > **Plugins** screen.
1. Delete the **Social Login with Auth0** plugin and confirm.
1. Go to **Plugins** > **Add New** and search for "Auth0".
1. For the **Login by Auth0** plugin (make sure to check the name), click **Install Now**.
1. When this completes, click **Activate**.
1. Check **Auth0** > **Settings** and make sure the previous settings remain. If not:
    1. Go to **Auth0** > **Import-Export Settings**.
    1. Paste in the settings JSON exported previously and click **Import**.
1. Completely delete the settings file export JSON (it contains sensitive information).

Everything should now be working as expected with the new plugin and updates will resume as usual.

## Keep Reading

More information on the Login by Auth0 WordPress plugin:

::: next-steps
* [How does it work?](/cms/wordpress/how-does-it-work)
* [Install the plugin](/cms/wordpress/installation)
* [Configure the plugin](/cms/wordpress/configuration)
* [Extend the plugin](/cms/wordpress/extending)
:::

redpajama_set_name: RedPajamaGithub


text:
from ROOT import TFile, TH1D
from ROOT import gDirectory, gROOT

triggerlookup = {"MinBias":0, "EMCJHigh":1, "EMCJLow":2, "EMCGHigh":3, "EMCGLow":4}

def GetTriggerScalers(filename):
    inputfile = TFile.Open(filename)
    inputfile.cd("PtEMCalTriggerTask")
    gDirectory.ls()
    tasklist = gDirectory.Get("results")
    histlist = tasklist.FindObject("histosPtEMCalTriggerHistograms")
    gROOT.cd()
    triggerhist = histlist.FindObject("hEventTriggers")
    inputfile.Close()

    # Get number of Min. Bias counts
    mbcounts = GetCounts(triggerhist, "MinBias")
    print "MinBias counts: %d" %(mbcounts)

    triggerhist.GetAxis(0).SetRange(2,2)
    triggercounts = {}
    for trigger in triggerlookup.keys():
        if trigger == "MinBias":
            continue
        triggercounts[trigger] = GetCounts(triggerhist, trigger)
        print "Number of events for trigger %s: %d" %(trigger, triggercounts[trigger])

    hScalers = TH1D("triggerScalers", "trigger scalers", len(triggercounts), -0.5, len(triggercounts) - 0.5)
    counter = 1
    for trigger in triggercounts.keys():
        scaler = float(mbcounts)/float(triggercounts[trigger])
        print "Scaler for trigger %s: %f" %(trigger, scaler)
        hScalers.GetXaxis().SetBinLabel(counter, trigger)
        hScalers.SetBinContent(counter, scaler)
        counter += 1

    outputfile = TFile("TriggerScalers.root", "RECREATE")
    outputfile.cd()
    hScalers.Write()
    outputfile.Close()

def GetCounts(triggerhist, triggerclass):
    projection = triggerhist.Projection(triggerlookup[triggerclass])
    return projection.GetBinContent(2)


text:
/**
 * Created by vgoya2 on 6/26/15.
 */
/// <reference path="../../../jspm_packages/npm/angular2/angular2.d.ts" />

import {Component, View, ObservableWrapper} from 'typings/app.exports';
import {IOrder} from '../../interfaces/order';
import {OrderRepo} from '../../services/order.repo';
import {ChartDir} from '../../directives/chart/chart.directive';
import * as Immutable from 'immutable';

@Component({
    selector: 'chart',
    appInjector: [OrderRepo],
    properties: ['chartOptions']
})
@View({
    templateUrl: 'src/components/chart/chart.html',
    styleUrls: ['src/components/chart/chart.css'],
    directives: [ChartDir]
})
export class Chart {
    chartOptions:Object;

    constructor(public orderRepo:OrderRepo) {
        this.chartOptions = {
            chart: {
                type: 'bar'
            },
            plotOptions: {
                series: {
                    stacking: 'percent'
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -40,
                y: 80,
                floating: true,
                borderWidth: 1,
                backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
                shadow: true
            },
            credits: {
                enabled: false
            }
        };
        ObservableWrapper.subscribe(orderRepo.getOrdersEmitter(), orders => {
            let placed = [];
            let executed = [];
            let total = [];
            if (orders.length) {
                orders.forEach(function (order) {
                    placed.push(order.quantityPlaced);
                    executed.push(order.quantityExecuted);
                    total.push(order.quantity);
                });
                this.formatData(placed, executed, total);
            }
        });
    }

    formatData(placed, executed, total) {
        let xAxis = [{
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[2]
                }
            },
            title: {
                text: 'Total',
                style: {
                    color: Highcharts.getOptions().colors[2]
                }
            },
            opposite: true

        }, {
            gridLineWidth: 0,
            title: {
                text: 'Order Id',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            }
        }];

        let yAxis = {
            min: 1,
            title: {
                text: 'Order Execution Status'
            },
            opposite: true
        };

        let series = [{
            name: 'Placed',
            type: 'bar',
            data: placed
        }, {
            name: 'Executed',
            type: 'bar',
            data: executed
        }, {
            name: 'Total Order',
            type: 'bar',
            data: total
        }];

        this.chartOptions = Object.assign(this.chartOptions, {
            yAxis: yAxis,
            series: series
        });
        this.chartOptions = Immutable.Map(this.chartOptions);
    }
}


text:
package com.flash3388.flashlib.io.devices.actuators;

import com.flash3388.flashlib.io.Pwm;

import java.io.Closeable;
import java.io.IOException;

/**
 * Control class for Pwm-controlled electronic devices. This class should be extended by electronic devices who use
 * Pwm and not instantiated.
 *
 * @since FlashLib 1.2.0
 */
public class PwmController implements Closeable {

	private Pwm mPort;
	private final PwmBounds mBounds;

	/**
	 * Creates a new Pwm device control for a given Pwm port.
	 *
	 * @param port the Pwm port
	 * @param pulseBounds the Pwm port bounds
     * @param pwmFrequency frequency of the Pwm in Hz
	 */
	public PwmController(Pwm port, PwmBounds pulseBounds, double pwmFrequency) {
		mPort = port;
		mPort.setFrequency(pwmFrequency);
		mBounds = calculateDutyBounds(pulseBounds, pwmFrequency);
	}

    public void setDutyCycle(double duty) {
        mPort.setDuty(duty);
    }

    public double getDutyCycle() {
        return mPort.getDuty();
    }

    public PwmBounds getBounds() {
	    return mBounds;
    }

	/**
	 * {@inheritDoc}
	 * <p>
	 * Releases the Pwm port used.
	 */
	@Override
	public void close() throws IOException {
		if (mPort != null) {
			mPort.close();
			mPort = null;
		}
	}

	private PwmBounds calculateDutyBounds(PwmBounds pulseBounds, double frequency) {
		double looptime = 1000.0 / frequency;

		double max = pulseBounds.getMaxPositive() / looptime;
		double deadbandMax = pulseBounds.getDeadbandMax() / looptime;
		double center = pulseBounds.getCenter() / looptime;
		double deadbandMin = pulseBounds.getDeadbandMin() / looptime;
		double min = pulseBounds.getMinNegative() / looptime;

		return new PwmBounds(max, deadbandMax, center, deadbandMin, min, pulseBounds.isDeadbandEliminated());
	}
}


text:
<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Request;
use App\Models\Admin\Token;

class CreateTokenRequest extends Request
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return Token::$rules;
    }
}


text:
namespace P03_HiddenMessage
{
    using System.Text;
    using System;

    public class Program
    {
        public static void Main()
        {
            var input = Console.ReadLine();
            var sb = new StringBuilder();
            while (input != "end")
            {
                var startIndex = int.Parse(input);
                var skipSymbolsNumber = int.Parse(Console.ReadLine());
                var message = Console.ReadLine().ToCharArray();

                if (startIndex < 0 && skipSymbolsNumber >= 0)
                {
                    while (startIndex < 0)
                    {
                        sb.Append(message[message.Length + startIndex]);
                        startIndex += skipSymbolsNumber;
                    }
                }
                else if (startIndex < 0 && skipSymbolsNumber < 0)
                {
                    while (message.Length + startIndex >= 0)
                    {
                        sb.Append(message[message.Length + startIndex]);
                        startIndex += skipSymbolsNumber;
                    }
                }
                else if (startIndex >= 0 && skipSymbolsNumber > 0)
                {
                    while (startIndex < message.Length)
                    {
                        sb.Append(message[startIndex]);
                        startIndex += skipSymbolsNumber;
                    }
                }
                else
                {
                    while (startIndex >= 0)
                    {
                        sb.Append(message[startIndex]);
                        startIndex += skipSymbolsNumber;
                    }
                }

                input = Console.ReadLine();
            }

            Console.WriteLine(sb.ToString());
        }
    }
}


text:
class Linux::LinuxRCOutput_Navio : public AP_HAL::RCOutput {
    public:
    LinuxRCOutput_Navio();
    ~LinuxRCOutput_Navio();
    void     init(void* machtnichts);
    void     reset_all_channels();
    void     set_freq(uint32_t chmask, uint16_t freq_hz);
    uint16_t get_freq(uint8_t ch);
    void     enable_ch(uint8_t ch);
    void     disable_ch(uint8_t ch);
    void     write(uint8_t ch, uint16_t period_us);
    void     write(uint8_t ch, uint16_t* period_us, uint8_t len);
    uint16_t read(uint8_t ch);
    void     read(uint16_t* period_us, uint8_t len);

private:
    void reset();

    AP_HAL::Semaphore *_i2c_sem;
    AP_HAL::DigitalSource *enable_pin;
    uint16_t _frequency;

    uint16_t *_pulses_buffer;
};

#endif // __AP_HAL_LINUX_RCOUTPUT_NAVIO_H__


text:
from __future__ import (absolute_import, division, print_function, unicode_literals)

from django.core.urlresolvers import reverse
from django.db import models

{% for model in models %}
class {{ model.name }}(models.Model):{% for field in model.fields %}
    {{ field.name }} = models.{{ field.class }}{% endfor %}
    class Meta:
        ordering = ('-id',)
        verbose_name = "{{ model.name }}"
        verbose_name_plural = "{{ model.name }}s"

    def __unicode__(self):
        return "{}".format(self.id)

    def get_absolute_url(self):
        return reverse('{{ app_name }}:{{ model.name|lower }}_detail', args=(self.id,))

    def get_update_url(self):
        return reverse('{{ app_name }}:{{ model.name|lower }}_update', args=(self.id,))
{% endfor %}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace LightDataInterface.Core.Test
{
    [TestClass]
    public class DataSessionHolderTest
    {
        private DataSessionHolder _dataSessionHolder;
        private Mock<IDataSession> _dataSessionMock;
        private Mock<IDataSessionFactory> _dataSessionFactoryMock;

        [TestInitialize]
        public void Initialize()
        {
            _dataSessionFactoryMock = new Mock<IDataSessionFactory>();
            _dataSessionMock = new Mock<IDataSession>();
            _dataSessionHolder = new DataSessionHolder(_dataSessionFactoryMock.Object);
        }

        [TestMethod]
        public void It_has_default_name_set()
        {
            // arrange

            // act

            // assert
            Assert.AreSame(_dataSessionHolder.DefaultName, "default");
        }

        [TestMethod]
        public void It_creates_new_datasession_if_not_exists_in_holder()
        {
            // arrange
            const string name = "some name";
            _dataSessionFactoryMock.Setup(x => x.CreateDataSession(name)).Returns(_dataSessionMock.Object);

            // act
            var dataSession = _dataSessionHolder.GetByName(name);

            // assert
            _dataSessionFactoryMock.Verify(x => x.CreateDataSession(name), Times.Once);
            Assert.AreSame(dataSession, _dataSessionMock.Object);
        }

        [TestMethod]
        public void It_reuses_existing_datasession_from_holder()
        {
            // arrange
            const string name = "some name";
            _dataSessionFactoryMock.Setup(x => x.CreateDataSession(name)).Returns(_dataSessionMock.Object);
            // ensure data session created
            _dataSessionHolder.GetByName(name);

            // act
            var dataSession = _dataSessionHolder.GetByName(name);

            // assert
            _dataSessionFactoryMock.Verify(x => x.CreateDataSession(name), Times.Once);
            Assert.AreSame(dataSession, _dataSessionMock.Object);
        }

        [TestMethod]
        public void It_disposes_all_datasessions_in_holder_uppon_dispose()
        {
            // arrange
            const string name1 = "some name";
            const string name2 = "some name 2";
            var dataSessionMock1 = new Mock<IDataSession>();
            var dataSessionMock2 = new Mock<IDataSession>();
            _dataSessionFactoryMock.Setup(x => x.CreateDataSession(name1)).Returns(dataSessionMock1.Object);
            _dataSessionFactoryMock.Setup(x => x.CreateDataSession(name2)).Returns(dataSessionMock2.Object);

            // ensure data sessions created
            _dataSessionHolder.GetByName(name1);
            _dataSessionHolder.GetByName(name2);

            // act
            _dataSessionHolder.Dispose();

            // assert
            dataSessionMock1.Verify(x => x.Dispose(), Times.Once);
            dataSessionMock2.Verify(x => x.Dispose(), Times.Once);
        }
    }
}


text:
import os

import dj_database_url
from django.contrib import messages
from django.urls import reverse

def user_url(user):
    return reverse("cab_author_snippets", kwargs={"username": user.username})

PROJECT_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)

SITE_ID = 1
SITE_NAME = "djangosnippets.org"

ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "djangosnippets.org,www.djangosnippets.org").split(",")

DEBUG = False

TIME_ZONE = "America/Chicago"
LANGUAGE_CODE = "en-us"
USE_I18N = True
USE_TZ = False

DEFAULT_FROM_EMAIL = "no-reply@djangosnippets.org"
SERVER_EMAIL = "no-reply@djangosnippets.org"
EMAIL_SUBJECT_PREFIX = "[djangosnippets] "

ABSOLUTE_URL_OVERRIDES = {
    "auth.user": user_url,
}

FORCE_WWW = False

ROOT_URLCONF = "djangosnippets.urls"

CACHE_KEY_PREFIX = "djangosnippets"
CACHE_MIDDLEWARE_KEY_PREFIX = CACHE_KEY_PREFIX
CACHE_MIDDLEWARE_SECONDS = 60

INSTALLED_APPS = (
    "django.contrib.auth",
    "django.contrib.admin",
    "django_comments",
    "django.contrib.contenttypes",
    "django.contrib.flatpages",
    "django.contrib.messages",
    "django.contrib.sessions",
    "django.contrib.staticfiles",
    "django.contrib.sites",
    "allauth",
    "allauth.account",
    "allauth.socialaccount",
    "allauth.socialaccount.providers.bitbucket",
    "allauth.socialaccount.providers.github",
    "allauth.socialaccount.providers.twitter",
    "cab",
    "comments_spamfighter",
    "ratings",
    "taggit",
    "captcha",
    "django_extensions",
    "rest_framework",
    "django_htmx",
)

MIDDLEWARE = (
    "django.middleware.security.SecurityMiddleware",
    "whitenoise.middleware.WhiteNoiseMiddleware",
    # 'django.middleware.cache.UpdateCacheMiddleware',
    "django.middleware.common.CommonMiddleware",
    # 'django.middleware.cache.FetchFromCacheMiddleware',
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware",
    "ratelimitbackend.middleware.RateLimitMiddleware",
    "django_htmx.middleware.HtmxMiddleware",
)

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [os.path.join(PROJECT_ROOT, "templates")],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.contrib.auth.context_processors.auth",
                "django.template.context_processors.debug",
                "django.template.context_processors.media",
                "django.template.context_processors.static",
                "django.contrib.messages.context_processors.messages",
                "django.template.context_processors.request",
            ],
        },
    }
]

STATIC_URL = "/assets/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, "..", "assets", "static")
STATICFILES_DIRS = (os.path.join(PROJECT_ROOT, "static"),)

SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"

ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 7
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_USERNAME_MIN_LENGTH = 3
ACCOUNT_ADAPTER = "djangosnippets.adapters.DjangoSnippetsAccountAdapter"
SOCIALACCOUNT_ADAPTER = "djangosnippets.adapters.DjangoSnippetsSocialAccountAdapter"
SOCIALACCOUNT_AUTO_SIGNUP = False

LOGIN_REDIRECT_URL = "/"
ACCOUNT_LOGOUT_REDIRECT_URL = "/"

COMMENTS_APP = "cab"

CAB_VERSIONS = (
    ("3.2", "3.2"),
    ("3.1", "3.1"),
    ("3.0", "3.0"),
    ("2.2", "2.2"),
    ("2.1", "2.1"),
    ("2.0", "2.0"),
    ("1.11", "1.11"),
    ("1.10", "1.10"),
    ("1.9", "1.9"),
    ("1.8", "1.8"),
    ("1.7", "1.7"),
    ("1.6", "1.6"),
    ("1.5", "1.5"),
    ("1.4", "1.4"),
    ("1.3", "1.3"),
    ("1.2", "1.2"),
    ("1.1", "1.1"),
    ("1.0", "1.0"),
    ("0.96", ".96"),
    ("0.95", "Pre .96"),
    ("0", "Not specified"),
)

# keys for localhost and 127.0.0.1
RECAPTCHA_PUBLIC_KEY = "6LcXj_oSAAAAAPQ3u23Y6MqQqd2yMYtnHqa7Zj61"
RECAPTCHA_PRIVATE_KEY = "6LcXj_oSAAAAAFN31LR-F31lwFSQAcJgsg1pE5WP"
RECAPTCHA_USE_SSL = True

AUTHENTICATION_BACKENDS = (
    "ratelimitbackend.backends.RateLimitModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend",
)

DISQUS_WEBSITE_SHORTNAME = "djangosnippets"
DISQUS_USE_SINGLE_SIGNON = True

MESSAGE_TAGS = {
    messages.DEBUG: "secondary",
    messages.INFO: "info",
    messages.SUCCESS: "success",
    messages.WARNING: "warning",
    messages.ERROR: "alert",
}

DATABASES = {"default": dj_database_url.config(default="postgres:///djangosnippets")}
DATABASES["default"]["ATOMIC_REQUESTS"] = True

REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly"]
}

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"


text:
from ..osid import receivers as osid_receivers

class RelationshipReceiver(osid_receivers.OsidReceiver):
    """The relationship receiver is the consumer supplied interface for receiving notifications pertaining to new, updated or
        deleted ``Relationship`` objects."""

    def new_relationships(self, notification_id, relationship_ids):
        """The callback for notifications of new relationships.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param relationship_ids: the ``Ids`` of the new ``Relationships``
        :type relationship_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

    def changed_relationships(self, notification_id, relationship_ids):
        """The callback for notification of updated relationships.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param relationship_ids: the ``Ids`` of the updated ``Relationships``
        :type relationship_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

    def deleted_relationships(self, notification_id, relationship_ids):
        """the callback for notification of deleted relationships.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param relationship_ids: the ``Ids`` of the deleted ``Relationships``
        :type relationship_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

class FamilyReceiver(osid_receivers.OsidReceiver):
    """The family receiver is the consumer supplied interface for receiving notifications pertaining to new, updated or deleted
        ``Family`` objects."""

    def new_families(self, notification_id, family_ids):
        """The callback for notifications of new families.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param family_ids: the ``Ids`` of the new ``Families``
        :type family_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

    def changed_families(self, notification_id, family_ids):
        """The callback for notification of updated families.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param family_ids: the ``Ids`` of the updated ``Families``
        :type family_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

    def deleted_families(self, notification_id, family_ids):
        """the callback for notification of deleted familys.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param family_ids: the ``Ids`` of the registered ``Families``
        :type family_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass

    def changed_child_of_families(self, notification_id, family_ids):
        """The callback for notifications of changes to children of family hierarchy nodes.

        :param notification_id: the notification ``Id``
        :type notification_id: ``osid.id.Id``
        :param family_ids: the ``Ids`` of the ``Families`` whose children have changed
        :type family_ids: ``osid.id.IdList``

        *compliance: mandatory -- This method must be implemented.*

        """
        pass


text:
import React    from 'react';
import Actions  from '../Actions';

class BubbleSlider extends React.Component {
  onChange (e) {
    Actions.changeNumBubbles(e.target.value);
  }

  render () {
    return (

{this.props.numBubbles + (this.props.numBubbles === 1 ? " Circle" : " Circles")}

        <input
          className="slider"
          type="range"
          min="1"
          max="250"
          value={this.props.numBubbles}
          steps="250"
          onChange={this.onChange.bind(this)} />

(might need to adjust for screen size or if animations are laggy)

    );
  }
}

module.exports = BubbleSlider;


text:
import React from 'react';

// The default value is never and should never be used.
// It's here to improve DX by enabling autocompletion for editors supporting TypeScript.
const PageContext = React.createContext({
  activePage: {
    pathname: '',
  },
  pages: [],
});

export default PageContext;


text:
package demo.elasticinsight_manager.events;

public class EsNewIndex {

}


text:
SHELL = /bin/bash
SUBDIRS = pxc

all:
	for i in $(SUBDIRS); do pushd $$i && make && popd; done

clean:
	for i in $(SUBDIRS); do pushd $$i && make clean && popd; done
	rm -rf dist

install: all
	for i in $(SUBDIRS); do pushd $$i && sudo make install && popd; done

uninstall:
	for i in $(SUBDIRS); do pushd $$i && sudo make uninstall && popd; done

rpms: clean
	mkdir -p dist
	mkdir dist/BUILD dist/RPMS dist/SOURCES dist/SPECS dist/SRPMS
	tar cvfz dist/pxc.tar.gz --exclude=.git pxc
	rpmbuild --define "_topdir `pwd`/dist" -ta dist/pxc.tar.gz

installrpms: uninstallrpms rpms
	sudo rpm -U dist/RPMS/*/*.rpm

uninstallrpms:
	- sudo rpm -e pxc
	- sudo rpm -e pxc-debuginfo


text:
<!DOCTYPE HTML>

<title>QueryPlanCollector (ebean api 12.8.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-03-18">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

All Classes

SEARCH:
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package io.ebean.metric

Interface QueryPlanCollector

public interface QueryPlanCollector

Object used to collect query plan metrics.

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method
Description

void
add(MetaQueryMetric stats)

Add the query plan statistic.

List<MetaQueryMetric>
complete()

Return all the collected query plan statistics.

boolean
isReset()

Return true if the statistics should be reset.

Method Detail

isReset

boolean isReset()

Return true if the statistics should be reset.

add

void add(MetaQueryMetric stats)

Add the query plan statistic.

complete

List<MetaQueryMetric> complete()

Return all the collected query plan statistics.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2021. All rights reserved.


text:
function $(id){
    return typeof id === 'string' ? document.getElementById(id):id;
}

window.onload = function(){
    //拿到所有的li标签
        var titles = $('tab-header').getElementsByTagName('li');
    //console.log(titles.length);
    var divs = $('tab-content').getElementsByTagName('div');

    //判断
    if(titles.length != divs.length)return;

    for(var i = 0;i<titles.length;i++){
        var li = titles[i];
        li.id = i;

        li.onmousemove = function(){

            //先遍历,清除选中
            for(var j=0;j<titles.length;j++){
                titles[j].className = '';
                divs[j].style.display = 'none';
            }

            //再单独加进去select
            this.className = 'select';
            divs[this.id].style.display = 'block';
        }
    }
}

var h1 = document.getElementsByTagName('h1')[0];
h1.innerHTML = '日本樱花网';

document.getElementById('footer').remove();

document.body.outerHTML