Skip to content

Commit

Permalink
core docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Jan 17, 2024
1 parent 6b1c3ff commit 93b687b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/libs/core/src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl<T: Type<T>> Param<T> {
}
}

#[doc(hidden)]
pub trait CanInto<T>: Sized {
const QUERY: bool = false;
}
Expand Down
10 changes: 10 additions & 0 deletions crates/libs/core/src/variant.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use super::*;

/// A VARIANT ([VARIANT](https://learn.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant)) is a container that can store different types of values.
#[repr(transparent)]
pub struct VARIANT(imp::VARIANT);

/// A PROPVARIANT ([PROPVARIANT](https://learn.microsoft.com/en-us/windows/win32/api/propidlbase/ns-propidlbase-propvariant)) is a container that can store different types of values.
#[repr(transparent)]
pub struct PROPVARIANT(imp::PROPVARIANT);

Expand Down Expand Up @@ -130,20 +132,28 @@ impl Eq for VARIANT {}
impl Eq for PROPVARIANT {}

impl VARIANT {
/// Create an empty `VARIANT`.
///
/// This function does not allocate memory.
pub fn new() -> Self {
unsafe { std::mem::zeroed() }
}

/// Returns true if the `VARIANT` is empty.
pub const fn is_empty(&self) -> bool {
unsafe { self.0.Anonymous.Anonymous.vt == imp::VT_EMPTY }
}
}

impl PROPVARIANT {
/// Create an empty `PROPVARIANT`.
///
/// This function does not allocate memory.
pub fn new() -> Self {
unsafe { std::mem::zeroed() }
}

/// Returns true if the `PROPVARIANT` is empty.
pub const fn is_empty(&self) -> bool {
unsafe { self.0.Anonymous.Anonymous.vt == imp::VT_EMPTY }
}
Expand Down

0 comments on commit 93b687b

Please sign in to comment.