pub const fn new(client_id: &'a str) -> Option<Self> {
        // this is really ugly to allow `const` evaluation

        const fn char_is_valid(ch: u8) -> bool {
            (ch >= b'A' && ch <= b'Z') || (ch >= b'a' && ch <= b'z') || (ch >= b'0' && ch <= b'9')
        }

        if client_id.is_empty() || client_id.len() > 23 {
            None
        } else {
            let mut idx: usize = 0;
            while idx < client_id.len() {
                if !char_is_valid(client_id.as_bytes()[idx]) {
                    return None;
                }
                idx += 1;
            }
            Some(Self { client_id })
        }
    }
/// Create a new client ID from a string.
///
/// # Requirements
///
/// If any requirement is not met `None` is returned.
///
/// * `client_id` must not be empty
/// * `client_id` must be 23 characters or fewer
/// * `client_id` must only contain characters in the ranges of
///   `b'a'..=b'z'`, `b'A'..=b'Z'`, and `b'0'..=b'9'`
///
/// # Example
///
/// ```
/// use w5500_mqtt::ClientId;
///
/// assert!(ClientId::new("valid").is_some());
/// assert!(ClientId::new("not-valid").is_none());
/// ```
Create a new client ID from a string.
Create a new client ID from a string .
pub const fn new(client_id: &'a str) -> Option<Self> {
        // this is really ugly to allow `const` evaluation
        const fn char_is_valid(ch: u8) -> bool {
            (ch >= b'A' && ch <= b'Z') || (ch >= b'a' && ch <= b'z') || (ch >= b'0' && ch <= b'9')
        }
        if client_id.is_empty() || client_id.len() > 23 {
            None
        } else {
            let mut idx: usize = 0;
            while idx < client_id.len() {
                if !char_is_valid(client_id.as_bytes()[idx]) {
                    return None;
                }
                idx += 1;
            }
            Some(Self { client_id })
        }
    }
pub const fn new ( client_id : & ' a str ) -> Option < Self > { // this is really ugly to allow `const` evaluation const fn char_is_valid ( ch : u8 ) -> bool { ( ch >= b'A' && ch <= b'Z' ) || ( ch >= b'a' && ch <= b'z' ) || ( ch >= b'0' && ch <= b'9' ) } if client_id . is_empty ( ) || client_id . len ( ) > 23 { None } else { let mut idx : usize = 0 ; while idx < client_id . len ( ) { if ! char_is_valid ( client_id . as_bytes ( ) [ idx ] ) { return None ; } idx += 1 ; } Some ( Self { client_id } ) } }
Create a new client ID from a string.
Create a new client ID from a string .
client_id
&'a str
client_id
&'a str
requirements
If any requirement is not met `None` is returned.

`client_id` must not be empty
`client_id` must be 23 characters or fewer
`client_id` must only contain characters in the ranges of
`b'a'..=b'z'`, `b'A'..=b'Z'`, and `b'0'..=b'9'`
If any requirement is not met ` None ` is returned . ` client_id ` must not be empty ` client_id ` must be 23 characters or fewer ` client_id ` must only contain characters in the ranges of ` b ' a ' .. = b ' z ' ` ` b ' A ' .. = b ' Z ' ` and ` b ' 0 ' .. = b ' 9 ' `
example
None