Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent const functions across string types #2810

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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