Function RasterLease.tryWritableView

Attempts to return a non-owning writable semantic view borrowing from this lease.

WritableRasterView!T tryWritableView(
  out bool success
) nothrow @nogc @trusted;

This is the public lease-bound writable-borrow operation.

It exposes only the semantic WritableRasterView capability. Writable certification and execution machinery remain package-internal.

A mutable RasterLease receiver is required. A const lease must not be usable to recover write capability.

success is false for:

- RasterLease.init / an uninitialized retained owner; - invalid retained metadata detected defensively by the reused factory; - a backing whose represented planes are not completely covered by retained readWrite resources.

On failure WritableRasterView.init is returned.

On success the returned WritableRasterView remains lifetime-bound to this lease exactly as RasterView returned by view() is.

Writable capability does not imply uniqueness, exclusivity, noalias, contiguity, non-overlap, or thread exclusivity.

Example

Example requesting writable access from an empty lease.

import raster;

RasterLease!ubyte lease;
bool success;
scope auto view = lease.tryWritableView(success);

assert(!success);
assert(view.planeCount == 0);
}