1 parent 65a2e68 commit a664532Copy full SHA for a664532
2 files changed
src/models/guild/role.rs
@@ -129,35 +129,10 @@ impl GuildRole {
129
Self::default()
130
}
131
132
- /// Returns true if this role is hoisted (displayed separately).
133
- pub fn is_hoisted(&self) -> bool {
134
- self.hoist != 0
135
- }
136
-
137
/// Converts the role to the numeric hoist value expected by the API.
138
pub fn hoist_as_u32(&self) -> u32 {
139
self.hoist_value()
140
141
142
- /// Gets the role's color as a hex value.
143
- pub fn color_hex(&self) -> Option<String> {
144
- (self.color != 0).then(|| format!("#{:06X}", self.color))
145
146
147
- /// Gets the number of members with this role.
148
- pub fn member_count(&self) -> u32 {
149
- self.member_count
150
151
152
- /// Gets the member limit for this role.
153
- pub fn get_member_limit(&self) -> u32 {
154
- self.member_limit
155
156
157
- /// Returns true if the role has reached its member limit.
158
- pub fn is_at_member_limit(&self) -> bool {
159
- self.member_limit > 0 && self.member_count >= self.member_limit
160
161
162
163
impl HasId for GuildRole {
src/models/guild/tests.rs
@@ -128,8 +128,8 @@ fn test_role_creation() {
128
let role = GuildRole::new();
assert_eq!(role.id, "");
assert_eq!(role.name, "");
- assert!(!role.is_hoisted());
- assert_eq!(role.member_count(), 0);
+ assert_eq!(role.hoist, 0);
+ assert_eq!(role.member_count, 0);
#[test]
@@ -144,11 +144,11 @@ fn test_role_with_data() {
assert_eq!(role.id(), Some(&"role123".to_string()));
assert_eq!(role.name(), "Admin");
- assert_eq!(role.color_hex(), Some("#FF0000".to_string()));
- assert!(role.is_hoisted());
- assert_eq!(role.member_count(), 5);
- assert_eq!(role.get_member_limit(), 10);
- assert!(!role.is_at_member_limit());
+ assert_eq!(role.color, 0xFF0000);
+ assert_eq!(role.hoist, 1);
+ assert_eq!(role.member_count, 5);
+ assert_eq!(role.member_limit, 10);
+ assert!(role.member_count < role.member_limit);
0 commit comments