Skip to content

Commit

Permalink
Implement SecurityCapabilities in rbx_types (#358)
Browse files Browse the repository at this point in the history
This PR implements `SecurityCapabilities` in rbx_types. Its
functionality is very limited right now because we have almost no idea
what this datatype does or how to interact with it!

I want rojo-rbx/rbx-test-files#23 merged before adding functionality for
`SecurityCapabilities` to any other of the crates. dekko pls review it
thoroughly and make sure I got it right
  • Loading branch information
kennethloeffler authored Sep 15, 2023
1 parent fc95b61 commit 88f9d09
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Roblox Lua implementation of DOM APIs, allowing Instance reflection from inside
| Ref | `Model.PrimaryPart` |||||
| Region3 | N/A |||||
| Region3int16 | `Terrain.MaxExtents` |||||
| SecurityCapabilities | `Folder.SecurityCapabilities` |||||
| SharedString | N/A |||||
| String | `Instance.Name` |||||
| UDim | `UIListLayout.Padding` |||||
Expand Down
4 changes: 3 additions & 1 deletion rbx_types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# rbx_types Changelog

## Unreleased Changes
* Implement `FromStr` for `TerrainMaterials`. ([#354])
* Implemented `FromStr` for `TerrainMaterials`. ([#354])
* `MaterialColorsError` and `UniqueIdError` are no longer publicly exposed. ([#355])
* Implemented barebones `SecurityCapabilities`. ([#358])

[#354]: https://github.com/rojo-rbx/rbx-dom/pull/354
[#355]: https://github.com/rojo-rbx/rbx-dom/pull/355
[#358]: https://github.com/rojo-rbx/rbx-dom/pull/358

## 1.6.0 (2023-08-09)
* Added support for `UniqueId` values. ([#271])
Expand Down
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
19 changes: 19 additions & 0 deletions rbx_types/src/security_capabilities.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#[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 from_bits(value: u64) -> Self {
SecurityCapabilities { value }
}

pub fn bits(self) -> u64 {
self.value
}
}
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 88f9d09

Please sign in to comment.