Skip to content

Commit

Permalink
Implement SecurityCapabilities in rbx_types
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethloeffler committed Sep 14, 2023
1 parent b9d6a42 commit 3f5aa3e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions rbx_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod lister;
mod material_colors;
mod physical_properties;
mod referent;
mod security_capabilities;
mod shared_string;
mod tags;
mod unique_id;
Expand All @@ -32,6 +33,7 @@ pub use font::*;
pub use material_colors::*;
pub use physical_properties::*;
pub use referent::*;
pub use security_capabilities::*;
pub use shared_string::*;
pub use tags::*;
pub use unique_id::*;
Expand Down
23 changes: 23 additions & 0 deletions rbx_types/src/security_capabilities.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::fmt;

#[derive(Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize),
serde(transparent)
)]
pub struct SecurityCapabilities {
value: u64,
}

impl SecurityCapabilities {
pub fn new(value: u64) -> Self {
SecurityCapabilities { value }
}
}

impl fmt::Display for SecurityCapabilities {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
5 changes: 3 additions & 2 deletions rbx_types/src/variant.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
Attributes, Axes, BinaryString, BrickColor, CFrame, Color3, Color3uint8, ColorSequence,
Content, Enum, Faces, Font, MaterialColors, NumberRange, NumberSequence, PhysicalProperties,
Ray, Rect, Ref, Region3, Region3int16, SharedString, Tags, UDim, UDim2, UniqueId, Vector2,
Vector2int16, Vector3, Vector3int16,
Ray, Rect, Ref, Region3, Region3int16, SecurityCapabilities, SharedString, Tags, UDim, UDim2,
UniqueId, Vector2, Vector2int16, Vector3, Vector3int16,
};

/// Reduces boilerplate from listing different values of Variant by wrapping
Expand Down Expand Up @@ -132,6 +132,7 @@ make_variant! {
Font(Font),
UniqueId(UniqueId),
MaterialColors(MaterialColors),
SecurityCapabilities(SecurityCapabilities),
}

impl From<&'_ str> for Variant {
Expand Down

0 comments on commit 3f5aa3e

Please sign in to comment.