Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

RwWriteGuard

Owns exclusive writable lock access and retained payload lifetime. Cannot copy, cross await or transfer threads. Move transfers only within the acquiring thread; moved guards are inert. Cleanup unlocks before releasing payload storage. Every returned reference expires at unlock/move/destruction.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.sync

import std.sync;

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

RwWriteGuard

pub final class RwWriteGuard<T> where T: Movable

Owns exclusive writable lock access and retained payload lifetime. Cannot copy, cross await or transfer threads. Move transfers only within the acquiring thread; moved guards are inert. Cleanup unlocks before releasing payload storage. Every returned reference expires at unlock/move/destruction. T: Movable protected payload.

RwWriteGuard.init

pub init(Source: readonly Self&) = delete;

Rejects duplicate unlock authority. Source: Existing guard.

RwWriteGuard.init

pub init(Source: mut Self&&)

Transfers unlock authority within the same thread. Source: Guard left inert.

RwWriteGuard.operator

pub fn operator =(Source: readonly Self&) -> void = delete;

Rejects copying unlock authority. Source: Existing guard. Return: No runtime result; this assignment is deleted and cannot be invoked.

RwWriteGuard.operator

pub fn operator =(Source: mut Self&&) -> void = delete;

Rejects replacement of an active guard; use a new scoped guard instead. Source: Transfer source. Return: No runtime result; this assignment is deleted and cannot be invoked.

RwWriteGuard.IsEmpty

pub IsEmpty: bool;

Observes moved/inert guard state.

RwWriteGuard.Value

pub readonly fn Value() -> readonly T&

Borrows protected payload readonly until this guard is moved/unlocked/destroyed. Return: Readonly reference; moved guard access traps.

RwWriteGuard.Value

pub fn Value() -> mut T&

Borrows protected payload writable under exclusive access. Return: Writable reference valid through this live guard.

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