Struct alloc::alloc::Global[−][src]

pub struct Global;
🔬 This is a nightly-only experimental API. (allocator_api #32838)
Expand description

内存分配器。

此类型通过将调用转发到用 #[global_allocator] 属性注册的分配器 (如果有的话) 或 std crate 的默认值来实现 Allocator trait。

Note: 尽管此类型不稳定,但是可以通过 free functions in alloc 访问其提供的功能。

Trait Implementations

🔬 This is a nightly-only experimental API. (allocator_api #32838)

尝试分配一块内存。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

行为类似于 allocate,但也确保返回的内存被零初始化。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

释放 ptr 引用的内存。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

尝试扩展内存块。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

行为类似于 grow,但也确保在返回新内容之前将其设置为零。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

尝试缩小内存块。 Read more

🔬 This is a nightly-only experimental API. (allocator_api #32838)

为此 Allocator 实例创建 “by reference” 适配器。 Read more

返回值的副本。 Read more

从 source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

返回类型的 “default value”。 Read more

Auto Trait Implementations

Blanket Implementations

获取 self 的 TypeId。 Read more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

通常通过克隆从借用数据中创建拥有的数据。 Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

recently added

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。