mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-28 01:32:24 +00:00
fix up docs warnings
This commit is contained in:
parent
99e95084a6
commit
b39b6813a7
@ -19,16 +19,18 @@ use alloc::{
|
||||
vec,
|
||||
vec::Vec,
|
||||
};
|
||||
use core::mem::ManuallyDrop;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use core::{
|
||||
mem::ManuallyDrop,
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
|
||||
/// As [`try_cast_box`](try_cast_box), but unwraps for you.
|
||||
/// As [`try_cast_box`], but unwraps for you.
|
||||
#[inline]
|
||||
pub fn cast_box<A: NoUninit, B: AnyBitPattern>(input: Box<A>) -> Box<B> {
|
||||
try_cast_box(input).map_err(|(e, _v)| e).unwrap()
|
||||
}
|
||||
|
||||
/// Attempts to cast the content type of a [`Box`](alloc::boxed::Box).
|
||||
/// Attempts to cast the content type of a [`Box`].
|
||||
///
|
||||
/// On failure you get back an error along with the starting `Box`.
|
||||
///
|
||||
@ -139,12 +141,12 @@ pub fn try_zeroed_slice_box<T: Zeroable>(
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`try_zeroed_slice_box`](try_zeroed_slice_box), but unwraps for you.
|
||||
/// As [`try_zeroed_slice_box`], but unwraps for you.
|
||||
pub fn zeroed_slice_box<T: Zeroable>(length: usize) -> Box<[T]> {
|
||||
try_zeroed_slice_box(length).unwrap()
|
||||
}
|
||||
|
||||
/// As [`try_cast_slice_box`](try_cast_slice_box), but unwraps for you.
|
||||
/// As [`try_cast_slice_box`], but unwraps for you.
|
||||
#[inline]
|
||||
pub fn cast_slice_box<A: NoUninit, B: AnyBitPattern>(
|
||||
input: Box<[A]>,
|
||||
@ -195,13 +197,13 @@ pub fn try_cast_slice_box<A: NoUninit, B: AnyBitPattern>(
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`try_cast_vec`](try_cast_vec), but unwraps for you.
|
||||
/// As [`try_cast_vec`], but unwraps for you.
|
||||
#[inline]
|
||||
pub fn cast_vec<A: NoUninit, B: AnyBitPattern>(input: Vec<A>) -> Vec<B> {
|
||||
try_cast_vec(input).map_err(|(e, _v)| e).unwrap()
|
||||
}
|
||||
|
||||
/// Attempts to cast the content type of a [`Vec`](alloc::vec::Vec).
|
||||
/// Attempts to cast the content type of a [`Vec`].
|
||||
///
|
||||
/// On failure you get back an error along with the starting `Vec`.
|
||||
///
|
||||
@ -300,7 +302,7 @@ pub fn pod_collect_to_vec<A: NoUninit, B: NoUninit + AnyBitPattern>(
|
||||
dst
|
||||
}
|
||||
|
||||
/// As [`try_cast_rc`](try_cast_rc), but unwraps for you.
|
||||
/// As [`try_cast_rc`], but unwraps for you.
|
||||
#[inline]
|
||||
pub fn cast_rc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
|
||||
input: Rc<A>,
|
||||
@ -308,7 +310,7 @@ pub fn cast_rc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
|
||||
try_cast_rc(input).map_err(|(e, _v)| e).unwrap()
|
||||
}
|
||||
|
||||
/// Attempts to cast the content type of a [`Rc`](alloc::rc::Rc).
|
||||
/// Attempts to cast the content type of a [`Rc`].
|
||||
///
|
||||
/// On failure you get back an error along with the starting `Rc`.
|
||||
///
|
||||
@ -336,7 +338,7 @@ pub fn try_cast_rc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`try_cast_arc`](try_cast_arc), but unwraps for you.
|
||||
/// As [`try_cast_arc`], but unwraps for you.
|
||||
#[inline]
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
pub fn cast_arc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
|
||||
@ -345,7 +347,7 @@ pub fn cast_arc<A: NoUninit + AnyBitPattern, B: NoUninit + AnyBitPattern>(
|
||||
try_cast_arc(input).map_err(|(e, _v)| e).unwrap()
|
||||
}
|
||||
|
||||
/// Attempts to cast the content type of a [`Arc`](alloc::sync::Arc).
|
||||
/// Attempts to cast the content type of a [`Arc`].
|
||||
///
|
||||
/// On failure you get back an error along with the starting `Arc`.
|
||||
///
|
||||
@ -377,7 +379,7 @@ pub fn try_cast_arc<
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`try_cast_slice_rc`](try_cast_slice_rc), but unwraps for you.
|
||||
/// As [`try_cast_slice_rc`], but unwraps for you.
|
||||
#[inline]
|
||||
pub fn cast_slice_rc<
|
||||
A: NoUninit + AnyBitPattern,
|
||||
@ -439,7 +441,7 @@ pub fn try_cast_slice_rc<
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`try_cast_slice_arc`](try_cast_slice_arc), but unwraps for you.
|
||||
/// As [`try_cast_slice_arc`], but unwraps for you.
|
||||
#[inline]
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
pub fn cast_slice_arc<
|
||||
@ -557,8 +559,7 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>:
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert an [`Rc`](alloc::rc::Rc) to the inner type into an `Rc` to the
|
||||
/// wrapper type.
|
||||
/// Convert an [`Rc`] to the inner type into an `Rc` to the wrapper type.
|
||||
#[inline]
|
||||
fn wrap_rc(s: Rc<Inner>) -> Rc<Self> {
|
||||
// The unsafe contract requires that these two have
|
||||
@ -584,8 +585,7 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>:
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert an [`Arc`](alloc::sync::Arc) to the inner type into an `Arc` to
|
||||
/// the wrapper type.
|
||||
/// Convert an [`Arc`] to the inner type into an `Arc` to the wrapper type.
|
||||
#[inline]
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
fn wrap_arc(s: Arc<Inner>) -> Arc<Self> {
|
||||
@ -662,8 +662,7 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>:
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert an [`Rc`](alloc::rc::Rc) to the wrapper type into an `Rc` to the
|
||||
/// inner type.
|
||||
/// Convert an [`Rc`] to the wrapper type into an `Rc` to the inner type.
|
||||
#[inline]
|
||||
fn peel_rc(s: Rc<Self>) -> Rc<Inner> {
|
||||
// The unsafe contract requires that these two have
|
||||
@ -689,8 +688,7 @@ pub trait TransparentWrapperAlloc<Inner: ?Sized>:
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert an [`Arc`](alloc::sync::Arc) to the wrapper type into an `Arc` to
|
||||
/// the inner type.
|
||||
/// Convert an [`Arc`] to the wrapper type into an `Arc` to the inner type.
|
||||
#[inline]
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
fn peel_arc(s: Arc<Self>) -> Arc<Inner> {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
#![allow(unexpected_cfgs)]
|
||||
#![allow(clippy::match_like_matches_macro)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![cfg_attr(feature = "nightly_docs", feature(doc_cfg))]
|
||||
@ -83,7 +84,7 @@
|
||||
//! instead of just for a select list of array lengths.
|
||||
//! * `must_cast`: Provides the `must_` functions, which will compile error if
|
||||
//! the requested cast can't be statically verified.
|
||||
//! * `const_zeroed`: Provides the const [`zeroed`] function.
|
||||
//! * `const_zeroed`: Provides a const version of the `zeroed` function.
|
||||
|
||||
#[cfg(all(target_arch = "aarch64", feature = "aarch64_simd"))]
|
||||
use core::arch::aarch64;
|
||||
|
Loading…
Reference in New Issue
Block a user