Skip to content

Commit

Permalink
docs(type-gen): add docs for new method
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsonin committed Apr 27, 2024
1 parent 7e7935b commit 1b9e45d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/type_gen/key_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ macro_rules! key_wrapper_inner {
#[cfg(not(loom))]
impl $new_type
{
#[doc = ::std::concat!("Creates a new instance of [`", ::std::stringify!($new_type), "`].")]
#[inline]
$vis fn new(value: $orig_type) -> Self {
use $crate::traits::BlazeMapIdStatic;
Expand Down
1 change: 1 addition & 0 deletions src/type_gen/key_wrapper_bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ macro_rules! key_wrapper_bounded_inner {
#[cfg(not(loom))]
impl $new_type
{
#[doc = ::std::concat!("Creates a new instance of [`", ::std::stringify!($new_type), "`].")]
#[inline]
$vis fn new(value: $orig_type) -> Self {
use $crate::traits::BlazeMapIdStatic;
Expand Down
2 changes: 2 additions & 0 deletions src/type_gen/plain_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ macro_rules! plain_id_inner {

impl $new_type
{
#[doc = ::std::concat!("Creates a new instance of [`", ::std::stringify!($new_type), "`].")]
#[inline]
#[cfg(not(loom))]
$vis fn new() -> Self {
let next_id = <Self as $crate::prelude::BlazeMapIdStatic>::static_container().next_id();
Self(unsafe { $crate::utils::OffsetProvider::<usize>::new(next_id) })
}

#[doc = ::std::concat!("Creates a new instance of [`", ::std::stringify!($new_type), "`].")]
#[inline]
#[cfg(loom)]
$vis fn new(type_info_container: &<Self as $crate::prelude::BlazeMapId>::TypeInfoContainer) -> Self {
Expand Down

0 comments on commit 1b9e45d

Please sign in to comment.