zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use serde::{Deserialize, Serialize};

use crate::{impl_cow, GroupSetting};

/// Represents a group-setting value defining the set of users who have permission to subscribe themselves to this channel.
///
/// Everyone, excluding guests, can subscribe to any public channel irrespective of this setting.  Users in this group can subscribe to a private channel as well.
///
/// Note that a user must `have content access` to a channel and permission to administer the channel in order to modify this setting.
///
/// **Changes**: New in Zulip 10.0 (feature level 357).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CanSubscribeGroup(pub GroupSetting);

impl CanSubscribeGroup {
    /// Creates a new [Self].
    pub const fn new() -> Self {
        Self(GroupSetting::new())
    }

    /// Converts the inner representation into a [Self].
    pub const fn from_inner(val: GroupSetting) -> Self {
        Self(val)
    }

    /// Converts the [Self] into the inner representation.
    pub fn into_inner(self) -> GroupSetting {
        self.0
    }
}

impl Default for CanSubscribeGroup {
    fn default() -> Self {
        Self::new()
    }
}

impl_cow!(CanSubscribeGroup);