Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

DequeInsertionError

Owns an uninserted deque item and its recoverable storage failure.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.collections

import std.collections;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

DequeInsertionError

pub final class DequeInsertionError<T>

Owns an uninserted deque item and its recoverable storage failure. T: Original item type transferred into the failure without copying.

Example

module example.deque_insertion_error;
from std.collections import Deque;
from std.memory import AllocationError, Layout;
from std.prelude import Result;
struct RejectingAllocator {
    pub unsafe fn Allocate(StorageLayout: Layout) -> Result<mut byte*, AllocationError> {
        return .Err { Error = .OutOfMemory };
    }
    pub unsafe fn Free(Storage: mut byte*, StorageLayout: Layout) -> void {}
}
fn Main() -> i32 {
    var Values = Deque<i32, RejectingAllocator>.WithAllocator(default(RejectingAllocator));
    switch Values.TryPushFront(42) {
        case .Ok => return 1;
        case .Err { Error = Failure } => {
            if Failure.Reason != .OutOfMemory || Failure.Value != 42 { return 2; }
        }
    }
    if !Values.IsEmpty { return 3; }
    return 0;
}

DequeInsertionError.Reason

pub Reason: AllocationError;

Stable allocation/layout failure reason.

DequeInsertionError.Value

pub Value: T;

Owns the original uninserted item.

DequeInsertionError.init

pub init(Reason: AllocationError, mut Value: T)

Stores the failure and transfers the original item. Reason: Exact recoverable storage failure. Value: Uninserted item transferred into the result.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library