Table of Contents

Class ResourceRequestHandle

Namespace
Maplibre.NativeFfi
Assembly
Maplibre.NativeFfi.dll

A resource load that a resource provider answers.

public sealed class ResourceRequestHandle : IDisposable
Inheritance
ResourceRequestHandle
Implements
Inherited Members

Remarks

See mln_resource_request in the C API reference.

Properties

Id

The native handle value. It stays readable after release.

public ulong Id { get; }

Property Value

ulong

IsClosed

Whether a release, dispose, or discard has ended the handle.

public bool IsClosed { get; }

Property Value

bool

Methods

Complete(ResourceResponse)

Answers a resource request.

public void Complete(ResourceResponse response)

Parameters

response ResourceResponse

Remarks

A failed answer fails the request with ResourceErrorReason.Other, as ResourceRequestHandle.Release() does.

See mln_resource_request_complete in the C API reference.

Errors:

  • Status.InvalidState when the library cancelled the request.

IsCancelled()

Reads whether the library cancelled a resource request.

public bool IsCancelled()

Returns

bool

Remarks

See mln_resource_request_is_cancelled in the C API reference.

PassThrough()

Hands a resource request back to the library to load as usual.

public void PassThrough()

Remarks

A failed call fails the request with ResourceErrorReason.Other, as ResourceRequestHandle.Release() does.

See mln_resource_request_pass_through in the C API reference.

Errors:

  • Status.InvalidState when the library cancelled the request.

Release()

Releases a resource request.

public void Release()

Remarks

Releasing a request without an answer fails it with ResourceErrorReason.Other.

See mln_resource_request_release in the C API reference.

SetCancelCallback(ResourceRequestCancelHandler)

Calls a callback when the library cancels a resource request.

public bool SetCancelCallback(ResourceRequestCancelHandler handler)

Parameters

handler ResourceRequestCancelHandler

Returns

bool

Remarks

The callback never runs after the request is answered. A request takes one cancel callback. When the library has already cancelled the request, the call reports that instead and the callback never runs.

See mln_resource_request_set_cancel_callback in the C API reference.

ToString()

Names the handle's type, its Id, and whether it is closed.

public override string ToString()

Returns

string