Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub mod any
Utilities for dynamic typing or type reflection.
module core Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct LayoutError
The LayoutError is returned when the parameters given to Layout::from_size_align or some other Layout constructor do not satisfy its documented constraints.
struct core Stable since 1.50.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn size(&self) -> usize
The minimum size in bytes for a memory block of this layout.
method core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn repeat_packed(&self, n: usize) -> Result<Self, LayoutError>
Creates a layout describing the record for n instances of self, with no padding between each instance.
method core Stable since 1.95.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn repeat(&self, n: usize) -> Result<(Self, usize), LayoutError>
Creates a layout describing the record for n instances of self, with a suitable amount of padding between each to ensure that each instance is given its requested size and alignment. On success, returns (k, offs) where k is the layout of the array and offs is the distance between the start of each element in the array.
method core Stable since 1.95.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn pad_to_align(&self) -> Layout
Creates a layout by rounding the size of this layout up to a multiple of the layout's alignment.
method core Stable since 1.44.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new<T>() -> Self
Constructs a Layout suitable for holding a value of type T.
associated_function core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self
Creates a layout, bypassing all checks.
associated_function core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_size_align(size: usize, align: usize) -> Result<Self, LayoutError>
Constructs a Layout from a given size and align, or returns LayoutError if any of the following conditions are not met:
associated_function core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn for_value_raw<T>(val: *const T) -> Self
Produces layout describing a record that could be used to allocate backing structure for T (which could be a trait or other unsized type like a slice).
associated_function core Stable since 1.100.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn for_value<T>(t: &T) -> Self
Produces layout describing a record that could be used to allocate backing structure for T (which could be a trait or other unsized type like a slice).
associated_function core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn extend_packed(&self, next: Self) -> Result<Self, LayoutError>
Creates a layout describing the record for self followed by next with no additional padding between the two. Since no padding is inserted, the alignment of next is irrelevant, and is not incorporated at all into the resulting layout.
method core Stable since 1.95.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn extend(&self, next: Self) -> Result<(Self, usize), LayoutError>
Creates a layout describing the record for self followed by next, including any necessary padding to ensure that next will be properly aligned, but no trailing padding.
method core Stable since 1.44.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn dangling_ptr(&self) -> NonNull<u8>
Creates a NonNull that is dangling, but well-aligned for this Layout.
method core Stable since 1.95.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn array<T>(n: usize) -> Result<Self, LayoutError>
Creates a layout describing the record for a [T; n].
associated_function core Stable since 1.44.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn align_to(&self, align: usize) -> Result<Self, LayoutError>
Creates a layout describing the record that can hold a value of the same layout as self, but that also is aligned to alignment align (measured in bytes).
method core Stable since 1.44.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const fn align(&self) -> usize
The minimum byte alignment for a memory block of this layout.
method core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
pub struct Layout
Layout of a block of memory.
struct core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
Shrinks or grows a block of memory to the given new_size in bytes. The block is described by the given ptr pointer and layout.
method core Stable since 1.28.0 Version 1.100.0-nightly
doc.rust-lang.org
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)
Deallocates the block of memory at the given ptr pointer with the given layout.
method core Stable since 1.28.0 Version 1.100.0-nightly
"I guess I would say that, it’s not only important that it be possible to do a good design in a given language, but that the language actively encour..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.