pub struct PacketBuilder { /* private fields */ }
Expand description

PacketBuilder can help pack bancho packets.

Usages:

use bancho_packets::{server, PacketBuilder, LoginResult};

let packet = PacketBuilder::new()
    .add(server::login_reply(LoginResult::Success(1009)))
    .add(server::protocol_version(19))
    .add(server::notification("Welcome to osu!"))
    .add(server::main_menu_icon(
        "https://image.png",
        "https://url.link",
    ))
    .add(server::silence_end(0))
    .add(server::channel_info_end())
    .build();

Implementations§

Create an empty PacketBuilder.

Create PacketBuilder with capacity.

Create PacketBuilder with PacketId.

Consume this PacketBuilder and return data.

Create a PacketBuilder from multiple packets.

Batch add packets to PacketBuilder.

Batch add packets to PacketBuilder.

Add an packet to PacketBuilder.

Add an packet to PacketBuilder.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.