Skip to content

Commit

Permalink
Consistent const functions across string types (#2810)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Jan 19, 2024
1 parent 0a884e7 commit 9e3b2b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/libs/core/src/strings/pcstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ impl PCSTR {
}

/// Construct a null `PCSTR`
pub fn null() -> Self {
pub const fn null() -> Self {
Self(std::ptr::null())
}

/// Returns a raw pointer to the `PCSTR`
pub fn as_ptr(&self) -> *const u8 {
pub const fn as_ptr(&self) -> *const u8 {
self.0
}

Expand Down
4 changes: 2 additions & 2 deletions crates/libs/core/src/strings/pstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ impl PSTR {
}

/// Construct a null `PSTR`
pub fn null() -> Self {
pub const fn null() -> Self {
Self(std::ptr::null_mut())
}

/// Returns a raw pointer to the `PSTR`
pub fn as_ptr(&self) -> *mut u8 {
pub const fn as_ptr(&self) -> *mut u8 {
self.0
}

Expand Down
4 changes: 2 additions & 2 deletions crates/libs/core/src/strings/pwstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ impl PWSTR {
}

/// Construct a null `PWSTR`.
pub fn null() -> Self {
pub const fn null() -> Self {
Self(std::ptr::null_mut())
}

/// Returns a raw pointer to the `PWSTR`.
pub fn as_ptr(&self) -> *mut u16 {
pub const fn as_ptr(&self) -> *mut u16 {
self.0
}

Expand Down

0 comments on commit 9e3b2b8

Please sign in to comment.