Skip to content

Commit

Permalink
Show function signatures in crate root's list of functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 15, 2022
1 parent 1bc8a40 commit 42235f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::sync::Arc;

/// `&T` —▸ `T`
pub fn clone<T>(t: &T) -> T
where
T: DynClone,
{
unsafe { *Box::from_raw(<T as DynClone>::__clone_box(t, Private) as *mut T) }
}

/// `&T`&ensp;&mdash;&blacktriangleright;&ensp;`Box<T>`
pub fn clone_box<T>(t: &T) -> Box<T>
where
T: ?Sized + DynClone,
Expand All @@ -143,6 +145,7 @@ where
unsafe { Box::from_raw(fat_ptr as *mut T) }
}

/// `&mut Arc<T>`&ensp;&mdash;&blacktriangleright;&ensp;`&mut T`
pub fn arc_make_mut<T>(arc: &mut Arc<T>) -> &mut T
where
T: ?Sized + DynClone,
Expand All @@ -168,6 +171,7 @@ where
unsafe { &mut *ptr }
}

/// `&mut Rc<T>`&ensp;&mdash;&blacktriangleright;&ensp;`&mut T`
pub fn rc_make_mut<T>(rc: &mut Rc<T>) -> &mut T
where
T: ?Sized + DynClone,
Expand Down

0 comments on commit 42235f6

Please sign in to comment.