android-components / mozilla.components.service.fxa / RustObject

# RustObject

`abstract class RustObject<T> : Closeable` (source)

Base class that wraps an non-optional Pointer representing a pointer to a Rust object. This class implements Closeable but does not provide an implementation, forcing all subclasses to implement it. This ensures that all classes that inherit from RustObject will have their Pointer destroyed when the Java wrapper is destroyed.

### Constructors

<init> | `RustObject()` Base class that wraps an non-optional Pointer representing a pointer to a Rust object. This class implements Closeable but does not provide an implementation, forcing all subclasses to implement it. This ensures that all classes that inherit from RustObject will have their Pointer destroyed when the Java wrapper is destroyed.

### Properties

isConsumed | `val isConsumed: Boolean`
rawPointer | `open var rawPointer: T?`

### Functions

close | `open fun close(): Unit`
consumePointer | `fun consumePointer(): T`
destroy | `abstract fun destroy(p: T): Unit`
validPointer | `fun validPointer(): T`

### Companion Object Properties

RUST_STRING_ENCODING | `const val RUST_STRING_ENCODING: String`

### Companion Object Functions

getAndConsumeString | `fun getAndConsumeString(stringPtr: Pointer?): String?`
safeAsync | `fun <U> safeAsync(callback: (ByReference) -> U): FxaResult<U>`
safeSync | `fun <U> safeSync(callback: (ByReference) -> U): U`

### Inheritors

Config | `class Config : RustObject<RawConfig>` Config represents the server endpoint configurations needed for the authentication flow.
FirefoxAccount | `class FirefoxAccount : RustObject<RawFxAccount>` FirefoxAccount represents the authentication state of a client.