AllocError enumv0.1.0
Why an allocation, reallocation or release did not do what was asked.
pub enum AllocError: uint8 {
Unsupported = 1,
OutOfMemory = 2,
InvalidBlock = 3
}
Cases
| Name | Value | Description |
|---|---|---|
Unsupported | 1 | The layout cannot be served by this allocator at all: an alignment stricter than it can give, or a size it could never hold. A different allocator might succeed; retrying with this one will not. |
OutOfMemory | 2 | The allocator has no storage left. A smaller request might succeed, and so might this one later. |
InvalidBlock | 3 | The arguments do not describe an allocation this allocator handed out — a pointer it did not give, or a layout that does not match the one it was given with. This is a caller's mistake rather than a shortage. |
Methods
IsTransient
pub func IsTransient(self: AllocError) -> bool
Whether a later attempt could plausibly succeed.
self is borrowed. True only for OutOfMemory, which is a shortage rather than a mistake: Unsupported and
InvalidBlock describe the request rather than the moment, so repeating either gives the same answer.
Returns: whether asking again later could succeed