Struct gdnative_bindings_lily::StreamPeer[][src]

pub struct StreamPeer { /* fields omitted */ }
Expand description

core class StreamPeer inherits Reference (reference counted).

Official documentation

See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.

Memory management

The lifetime of this object is automatically managed through reference counting.

Class hierarchy

StreamPeer inherits methods from:

Safety

All types in the Godot API have “interior mutability” in Rust parlance. To enforce that the official thread-safety guidelines are followed, the typestate pattern is used in the Ref and TRef smart pointers, and the Instance API. The typestate Access in these types tracks whether the access is unique, shared, or exclusive to the current thread. For more information, see the type-level documentation on Ref.

Implementations

Gets a signed 16-bit value from the stream.

Gets a signed 32-bit value from the stream.

Gets a signed 64-bit value from the stream.

Gets a signed byte from the stream.

Returns the amount of bytes this StreamPeer has available.

Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the bytes argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an [enum @GlobalScope.Error] code and a data array.

Gets a double-precision float from the stream.

Gets a single-precision float from the stream.

Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the “bytes” argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an [enum @GlobalScope.Error] code, and a data array.

Gets a string with byte-length bytes from the stream. If bytes is negative (default) the length will be read from the stream using the reverse process of [method put_string].

Default Arguments

  • bytes - -1

Gets an unsigned 16-bit value from the stream.

Gets an unsigned 32-bit value from the stream.

Gets an unsigned 64-bit value from the stream.

Gets an unsigned byte from the stream.

Gets an UTF-8 string with byte-length bytes from the stream (this decodes the string sent as UTF-8). If bytes is negative (default) the length will be read from the stream using the reverse process of [method put_utf8_string].

Default Arguments

  • bytes - -1

Gets a Variant from the stream. If allow_objects is true, decoding objects is allowed. Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.

Default Arguments

  • allow_objects - false

If true, this StreamPeer will using big-endian format for encoding and decoding.

Puts a signed 16-bit value into the stream.

Puts a signed 32-bit value into the stream.

Puts a signed 64-bit value into the stream.

Puts a signed byte into the stream.

Sends a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an [enum @GlobalScope.Error] code.

Puts a double-precision float into the stream.

Puts a single-precision float into the stream.

Sends a chunk of data through the connection. If all the data could not be sent at once, only part of it will. This function returns two values, an [enum @GlobalScope.Error] code and an integer, describing how much data was actually sent.

Sample code is GDScript unless otherwise noted.

Puts a zero-terminated ASCII string into the stream prepended by a 32-bit unsigned integer representing its size. Note: To put an ASCII string without prepending its size, you can use [method put_data]:

put_data("Hello world".to_ascii())

Puts an unsigned 16-bit value into the stream.

Puts an unsigned 32-bit value into the stream.

Puts an unsigned 64-bit value into the stream.

Puts an unsigned byte into the stream.

Sample code is GDScript unless otherwise noted.

Puts a zero-terminated UTF-8 string into the stream prepended by a 32 bits unsigned integer representing its size. Note: To put an UTF-8 string without prepending its size, you can use [method put_data]:

put_data("Hello world".to_utf8())

Puts a Variant into the stream. If full_objects is true encoding objects is allowed (and can potentially include code).

Default Arguments

  • full_objects - false

If true, this StreamPeer will using big-endian format for encoding and decoding.

Methods from Deref<Target = Reference>

Initializes the internal reference counter. Use this only if you really know what you are doing. Returns whether the initialization was successful.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

The memory management kind of this type. This modifies the behavior of the Ref smart pointer. See its type-level documentation for more information. Read more

Creates an explicitly null reference of Self as a method argument. This makes type inference easier for the compiler compared to Option. Read more

Creates a new instance of Self using a zero-argument constructor, as a Unique reference. Read more

Performs a dynamic reference downcast to target type. Read more

Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more

Creates a persistent reference to the same Godot object with shared thread access. Read more

Creates a persistent reference to the same Godot object with thread-local thread access. Read more

Creates a persistent reference to the same Godot object with unique access. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive. See also TRef::try_from_instance_id. Read more

Recovers a instance ID previously returned by Object::get_instance_id if the object is still alive, and panics otherwise. This does NOT guarantee that the resulting reference is safe to use. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.