Struct BotApi

Source
pub struct BotApi { /* private fields */ }
Expand description

Bot API client for the QQ Guild Bot API.

Implementations§

Source§

impl BotApi

Source

pub fn new(http: HttpClient) -> Self

Creates a new Bot API client.

§Arguments
  • http - The HTTP client to use for requests
§Examples
use botrs::api::BotApi;
use botrs::http::HttpClient;

let http = HttpClient::new(30, false).unwrap();
let api = BotApi::new(http);
Source

pub async fn get_bot_info(&self, token: &Token) -> Result<BotInfo>

Gets information about the current bot.

§Arguments
  • token - Authentication token
§Returns

The bot’s information.

Source

pub async fn get_gateway(&self, token: &Token) -> Result<GatewayResponse>

Gets the WebSocket gateway URL.

§Arguments
  • token - Authentication token
§Returns

Gateway information including WebSocket URL.

Source

pub async fn get_guild(&self, token: &Token, guild_id: &str) -> Result<Guild>

Gets guild information.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
§Returns

Guild information.

Source

pub async fn get_guilds( &self, token: &Token, guild_id: Option<&str>, limit: Option<u32>, desc: Option<bool>, ) -> Result<Vec<Guild>>

Gets the current user’s guilds.

§Arguments
  • token - Authentication token
  • guild_id - Optional starting guild ID
  • limit - Maximum number of guilds to return (1-100)
  • desc - Whether to return results in descending order
§Returns

List of guilds.

Source

pub async fn get_guild_roles( &self, token: &Token, guild_id: &str, ) -> Result<GuildRoles>

Gets guild roles.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
§Returns

Guild roles information.

Source

pub async fn create_guild_role( &self, token: &Token, guild_id: &str, name: Option<&str>, color: Option<u32>, hoist: Option<bool>, ) -> Result<GuildRole>

Creates a new guild role.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • name - Role name
  • color - Role color (ARGB hex as decimal)
  • hoist - Whether to display separately in member list
§Returns

The created role.

Source

pub async fn update_guild_role( &self, token: &Token, guild_id: &str, role_id: &str, name: Option<&str>, color: Option<u32>, hoist: Option<bool>, ) -> Result<GuildRole>

Updates a guild role.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • role_id - The role ID
  • name - Role name
  • color - Role color (ARGB hex as decimal)
  • hoist - Whether to display separately in member list
§Returns

The updated role.

Source

pub async fn delete_guild_role( &self, token: &Token, guild_id: &str, role_id: &str, ) -> Result<()>

Deletes a guild role.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • role_id - The role ID
§Returns

Success indication.

Source

pub async fn create_guild_role_member( &self, token: &Token, guild_id: &str, role_id: &str, user_id: &str, channel_id: Option<&str>, ) -> Result<()>

Adds a member to a guild role.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • role_id - The role ID
  • user_id - The user ID
  • channel_id - Optional channel ID (for channel-specific roles)
§Returns

Success indication.

Source

pub async fn delete_guild_role_member( &self, token: &Token, guild_id: &str, role_id: &str, user_id: &str, channel_id: Option<&str>, ) -> Result<()>

Removes a member from a guild role.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • role_id - The role ID
  • user_id - The user ID
  • channel_id - Optional channel ID (for channel-specific roles)
§Returns

Success indication.

Source

pub async fn get_guild_member( &self, token: &Token, guild_id: &str, user_id: &str, ) -> Result<Member>

Gets a guild member.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • user_id - The user ID
§Returns

Member information.

Source

pub async fn get_guild_members( &self, token: &Token, guild_id: &str, after: Option<&str>, limit: Option<u32>, ) -> Result<Vec<Member>>

Gets guild members list.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • after - Get members after this user ID
  • limit - Maximum number of members to return (1-400)
§Returns

List of members.

Source

pub async fn delete_member( &self, token: &Token, guild_id: &str, user_id: &str, add_blacklist: Option<bool>, delete_history_msg_days: Option<i32>, ) -> Result<()>

Removes a member from a guild.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • user_id - The user ID
  • add_blacklist - Whether to add to blacklist
  • delete_history_msg_days - Days of message history to delete
§Returns

Success indication.

Source

pub async fn get_channel( &self, token: &Token, channel_id: &str, ) -> Result<Channel>

Gets channel information.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
§Returns

Channel information.

Source

pub async fn get_channels( &self, token: &Token, guild_id: &str, ) -> Result<Vec<Channel>>

Gets channels in a guild.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
§Returns

List of channels.

Source

pub async fn create_channel( &self, token: &Token, guild_id: &str, name: &str, channel_type: ChannelType, sub_type: ChannelSubType, position: Option<u32>, parent_id: Option<&str>, private_type: Option<u32>, private_user_ids: Option<Vec<String>>, speak_permission: Option<u32>, application_id: Option<&str>, ) -> Result<Channel>

Creates a new channel.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • name - Channel name
  • channel_type - Channel type
  • sub_type - Channel sub-type
  • position - Optional position
  • parent_id - Optional parent category ID
  • private_type - Optional private type
  • private_user_ids - Optional private user IDs
  • speak_permission - Optional speak permission
  • application_id - Optional application ID
§Returns

The created channel.

Source

pub async fn update_channel( &self, token: &Token, channel_id: &str, name: Option<&str>, position: Option<u32>, parent_id: Option<&str>, private_type: Option<u32>, speak_permission: Option<u32>, ) -> Result<Channel>

Updates a channel.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • name - Optional new name
  • position - Optional new position
  • parent_id - Optional new parent ID
  • private_type - Optional new private type
  • speak_permission - Optional new speak permission
§Returns

The updated channel.

Source

pub async fn delete_channel( &self, token: &Token, channel_id: &str, ) -> Result<Channel>

Deletes a channel.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
§Returns

The deleted channel.

Source

pub async fn get_message( &self, token: &Token, channel_id: &str, message_id: &str, ) -> Result<Message>

Gets a specific message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
§Returns

The message.

Source

pub async fn post_message_with_params( &self, token: &Token, channel_id: &str, params: MessageParams, ) -> Result<MessageResponse>

Sends a message to a channel using MessageParams.

This is the new, recommended way to send channel messages. It uses a parameter struct instead of many optional arguments, making the code cleaner and more maintainable.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • params - Message parameters (see MessageParams)
§Returns

The sent message response.

§Examples
// Simple text message
let params = MessageParams::new_text("Hello world!");
api.post_message_with_params(token, "channel_id", params).await?;

// Message with reply
let params = MessageParams::new_text("Reply!").with_reply("message_id");
api.post_message_with_params(token, "channel_id", params).await?;
Source

pub async fn post_message( &self, token: &Token, channel_id: &str, content: Option<&str>, embed: Option<&Embed>, ark: Option<&Ark>, message_reference: Option<&Reference>, image: Option<&str>, file_image: Option<&[u8]>, msg_id: Option<&str>, event_id: Option<&str>, markdown: Option<&MarkdownPayload>, keyboard: Option<&Keyboard>, ) -> Result<MessageResponse>

👎Deprecated since 0.1.0: Use post_message_with_params instead

Sends a message to a channel (legacy API for backward compatibility).

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • content - Message content
  • embed - Optional embed
  • ark - Optional ark template
  • message_reference - Optional message reference
  • image - Optional image URL
  • file_image - Optional file image data
  • msg_id - Optional message ID to reply to
  • event_id - Optional event ID
  • markdown - Optional markdown
  • keyboard - Optional keyboard
§Returns

The sent message response.

Source

pub async fn post_group_message_with_params( &self, token: &Token, group_openid: &str, params: GroupMessageParams, ) -> Result<MessageResponse>

Sends a group message using GroupMessageParams.

This is the new, recommended way to send group messages. It uses a parameter struct instead of many optional arguments, making the code cleaner and more maintainable.

§Arguments
  • token - Authentication token
  • group_openid - The group OpenID
  • params - Group message parameters (see GroupMessageParams)
§Returns

The sent group message response.

§Examples
let params = GroupMessageParams::new_text("Hello group!");
api.post_group_message_with_params(token, "group_openid", params).await?;
Source

pub async fn post_group_message( &self, token: &Token, group_openid: &str, msg_type: Option<u32>, content: Option<&str>, embed: Option<&Embed>, ark: Option<&Ark>, message_reference: Option<&Reference>, media: Option<&Media>, msg_id: Option<&str>, msg_seq: Option<u32>, event_id: Option<&str>, markdown: Option<&MarkdownPayload>, keyboard: Option<&KeyboardPayload>, ) -> Result<MessageResponse>

👎Deprecated since 0.1.0: Use post_group_message_with_params instead

Sends a group message (legacy API for backward compatibility).

§Arguments
  • token - Authentication token
  • group_openid - The group OpenID
  • msg_type - Message type (0=text, 1=rich text, 2=markdown, 3=ark, 4=embed, 7=media)
  • content - Message content
  • embed - Optional embed
  • ark - Optional ark template
  • message_reference - Optional message reference
  • media - Optional media
  • msg_id - Optional message ID to reply to
  • msg_seq - Optional message sequence number
  • event_id - Optional event ID
  • markdown - Optional markdown
  • keyboard - Optional keyboard
§Returns

The sent group message response.

Source

pub async fn post_c2c_message_with_params( &self, token: &Token, openid: &str, params: C2CMessageParams, ) -> Result<MessageResponse>

Sends a C2C (client-to-client) message using C2CMessageParams.

This is the new, recommended way to send C2C messages. It uses a parameter struct instead of many optional arguments, making the code cleaner and more maintainable.

§Arguments
  • token - Authentication token
  • openid - The user’s OpenID
  • params - C2C message parameters (see C2CMessageParams)
§Returns

The sent C2C message response.

§Examples
let params = C2CMessageParams::new_text("Hello user!");
api.post_c2c_message_with_params(token, "user_openid", params).await?;
Source

pub async fn post_c2c_message( &self, token: &Token, openid: &str, msg_type: Option<u32>, content: Option<&str>, embed: Option<&Embed>, ark: Option<&Ark>, message_reference: Option<&Reference>, media: Option<&Media>, msg_id: Option<&str>, msg_seq: Option<u32>, event_id: Option<&str>, markdown: Option<&MarkdownPayload>, keyboard: Option<&KeyboardPayload>, ) -> Result<MessageResponse>

👎Deprecated since 0.1.0: Use post_c2c_message_with_params instead

Sends a C2C (client-to-client) message (legacy API for backward compatibility).

§Arguments
  • token - Authentication token
  • openid - The user’s OpenID
  • msg_type - Message type (0=text, 1=rich text, 2=markdown, 3=ark, 4=embed, 7=media)
  • content - Message content
  • embed - Optional embed
  • ark - Optional ark template
  • message_reference - Optional message reference
  • media - Optional media
  • msg_id - Optional message ID to reply to
  • msg_seq - Optional message sequence number
  • event_id - Optional event ID
  • markdown - Optional markdown
  • keyboard - Optional keyboard
§Returns

The sent C2C message response.

Source

pub async fn post_dms_with_params( &self, token: &Token, guild_id: &str, params: DirectMessageParams, ) -> Result<MessageResponse>

Sends a direct message using DirectMessageParams.

This is the new, recommended way to send direct messages. It uses a parameter struct instead of many optional arguments, making the code cleaner and more maintainable.

§Arguments
  • token - Authentication token
  • guild_id - The DM session guild ID
  • params - Direct message parameters (see DirectMessageParams)
§Returns

The sent direct message response.

§Examples
let params = DirectMessageParams::new_text("Hello DM!");
api.post_dms_with_params(token, "guild_id", params).await?;
Source

pub async fn post_dms( &self, token: &Token, guild_id: &str, content: Option<&str>, embed: Option<&Embed>, ark: Option<&Ark>, message_reference: Option<&Reference>, image: Option<&str>, file_image: Option<&[u8]>, msg_id: Option<&str>, event_id: Option<&str>, markdown: Option<&MarkdownPayload>, keyboard: Option<&Keyboard>, ) -> Result<MessageResponse>

👎Deprecated since 0.1.0: Use post_dms_with_params instead

Sends a direct message (legacy API for backward compatibility).

§Arguments
  • token - Authentication token
  • guild_id - The DM session guild ID
  • content - Message content
  • embed - Optional embed
  • ark - Optional ark template
  • message_reference - Optional message reference
  • image - Optional image URL
  • file_image - Optional file image data
  • msg_id - Optional message ID to reply to
  • event_id - Optional event ID
  • markdown - Optional markdown
  • keyboard - Optional keyboard
§Returns

The sent direct message response.

Source

pub async fn create_dms( &self, token: &Token, guild_id: &str, user_id: &str, ) -> Result<Value>

Creates a direct message session.

§Arguments
  • token - Authentication token
  • guild_id - The source guild ID
  • user_id - The target user ID
§Returns

DM session information.

Source

pub async fn recall_message( &self, token: &Token, channel_id: &str, message_id: &str, hidetip: Option<bool>, ) -> Result<()>

Recalls (deletes) a message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
  • hidetip - Whether to hide the recall tip
§Returns

Success indication.

Source

pub async fn update_audio( &self, token: &Token, channel_id: &str, audio_control: &AudioAction, ) -> Result<()>

Updates audio control.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • audio_control - Audio control data
§Returns

Success indication.

Source

pub async fn on_microphone(&self, token: &Token, channel_id: &str) -> Result<()>

Turn on microphone.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
§Returns

Success indication.

Source

pub async fn off_microphone( &self, token: &Token, channel_id: &str, ) -> Result<()>

Turn off microphone.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
§Returns

Success indication.

Source

pub async fn mute_all( &self, token: &Token, guild_id: &str, mute_end_timestamp: Option<&str>, mute_seconds: Option<&str>, ) -> Result<()>

Mutes all members in a guild.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • mute_end_timestamp - Optional end timestamp
  • mute_seconds - Optional duration in seconds
§Returns

Success indication.

Source

pub async fn cancel_mute_all(&self, token: &Token, guild_id: &str) -> Result<()>

Cancels mute for all members.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
§Returns

Success indication.

Source

pub async fn mute_member( &self, token: &Token, guild_id: &str, user_id: &str, mute_end_timestamp: Option<&str>, mute_seconds: Option<&str>, ) -> Result<()>

Mutes a specific member.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • user_id - The user ID
  • mute_end_timestamp - Optional end timestamp
  • mute_seconds - Optional duration in seconds
§Returns

Success indication.

Source

pub async fn get_channel_user_permissions( &self, token: &Token, channel_id: &str, user_id: &str, ) -> Result<ChannelPermissions>

Gets channel permissions for a user.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • user_id - The user ID
§Returns

Channel permissions.

Source

pub async fn get_channel_role_permissions( &self, token: &Token, channel_id: &str, role_id: &str, ) -> Result<ChannelPermissions>

Gets channel permissions for a role.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • role_id - The role ID
§Returns

Channel permissions.

Source

pub async fn put_reaction( &self, token: &Token, channel_id: &str, message_id: &str, emoji_type: u32, emoji_id: &str, ) -> Result<()>

Adds a reaction to a message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
  • emoji_type - The emoji type (1=system, 2=emoji)
  • emoji_id - The emoji ID
§Returns

Success indication.

Source

pub async fn delete_reaction( &self, token: &Token, channel_id: &str, message_id: &str, emoji_type: u32, emoji_id: &str, ) -> Result<()>

Removes a reaction from a message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
  • emoji_type - The emoji type (1=system, 2=emoji)
  • emoji_id - The emoji ID
§Returns

Success indication.

Source

pub async fn put_pin( &self, token: &Token, channel_id: &str, message_id: &str, ) -> Result<Value>

Pins a message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
§Returns

Success indication.

Source

pub async fn delete_pin( &self, token: &Token, channel_id: &str, message_id: &str, ) -> Result<()>

Unpins a message.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
  • message_id - The message ID
§Returns

Success indication.

Source

pub async fn get_pins(&self, token: &Token, channel_id: &str) -> Result<Value>

Gets pinned messages.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID
§Returns

Pinned messages.

Source

pub async fn post_group_file( &self, token: &Token, group_openid: &str, file_type: u32, url: &str, srv_send_msg: Option<bool>, ) -> Result<Value>

Uploads a group file.

§Arguments
  • token - Authentication token
  • group_openid - The group OpenID
  • file_type - File type (1=image, 2=video, 3=audio, 4=file)
  • url - File URL
  • srv_send_msg - Whether to send directly
§Returns

Media response.

Source

pub async fn post_c2c_file( &self, token: &Token, openid: &str, file_type: u32, url: &str, srv_send_msg: Option<bool>, ) -> Result<Value>

Uploads a C2C file.

§Arguments
  • token - Authentication token
  • openid - The user’s OpenID
  • file_type - File type (1=image, 2=video, 3=audio, 4=file)
  • url - File URL
  • srv_send_msg - Whether to send directly
§Returns

Media response.

Source

pub async fn create_announce( &self, token: &Token, guild_id: &str, channel_id: &str, message_id: &str, ) -> Result<Announce>

Creates a message-type guild announcement.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID where the announcement will be created
  • channel_id - The channel ID containing the message to announce
  • message_id - The message ID to turn into an announcement
§Returns

The created announcement.

Source

pub async fn create_recommend_announce( &self, token: &Token, guild_id: &str, announces_type: AnnouncesType, recommend_channels: Vec<RecommendChannel>, ) -> Result<Announce>

Creates a recommended channel announcement.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID where the announcement will be created
  • announces_type - The type of announcement
  • recommend_channels - List of channels to recommend
§Returns

The created announcement.

Source

pub async fn delete_announce( &self, token: &Token, guild_id: &str, message_id: &str, ) -> Result<Value>

Deletes a guild announcement.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
  • message_id - The message ID of the announcement to delete, or “all” to delete all
§Returns

Success indication.

Source

pub async fn get_permissions( &self, token: &Token, guild_id: &str, ) -> Result<Vec<APIPermission>>

Gets the list of API permissions for a guild.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID
§Returns

List of API permissions.

Source

pub async fn post_permission_demand( &self, token: &Token, guild_id: &str, channel_id: &str, api_identify: APIPermissionDemandIdentify, desc: &str, ) -> Result<APIPermissionDemand>

Creates an API permission demand request.

§Arguments
  • token - Authentication token
  • guild_id - The guild ID where permission is requested
  • channel_id - The channel ID where the request will be sent
  • api_identify - The API identifier for which permission is requested
  • desc - Description explaining why the permission is needed
§Returns

The created permission demand.

Source

pub async fn get_reaction_users( &self, token: &Token, channel_id: &str, message_id: &str, emoji_type: EmojiType, emoji_id: &str, cookie: Option<&str>, limit: Option<u32>, ) -> Result<ReactionUsers>

Gets the list of users who reacted with a specific emoji.

§Arguments
  • token - Authentication token
  • channel_id - The channel ID containing the message
  • message_id - The message ID
  • emoji_type - The type of emoji (1 = system, 2 = custom)
  • emoji_id - The emoji ID
  • cookie - Optional pagination cookie from previous request
  • limit - Maximum number of users to return (1-100, default 20)
§Returns

List of users who reacted and pagination info.

Source

pub async fn get_schedules( &self, token: &Token, channel_id: &str, since: Option<&str>, ) -> Result<Vec<Schedule>>

Gets the list of schedules for a channel.

§Arguments
  • token - Authentication token
  • channel_id - The schedule channel ID
  • since - Optional timestamp to get schedules after this time
§Returns

List of schedules.

Source

pub async fn get_schedule( &self, token: &Token, channel_id: &str, schedule_id: &str, ) -> Result<Schedule>

Gets a specific schedule by ID.

§Arguments
  • token - Authentication token
  • channel_id - The schedule channel ID
  • schedule_id - The schedule ID
§Returns

The schedule details.

Source

pub async fn create_schedule( &self, token: &Token, channel_id: &str, name: &str, start_timestamp: &str, end_timestamp: &str, jump_channel_id: &str, remind_type: RemindType, ) -> Result<Schedule>

Creates a new schedule in a channel.

§Arguments
  • token - Authentication token
  • channel_id - The schedule channel ID
  • name - Name of the schedule
  • start_timestamp - Start time as Unix timestamp string
  • end_timestamp - End time as Unix timestamp string
  • jump_channel_id - Channel ID to jump to when event starts
  • remind_type - Type of reminder to set
§Returns

The created schedule.

Source

pub async fn update_schedule( &self, token: &Token, channel_id: &str, schedule_id: &str, name: &str, start_timestamp: &str, end_timestamp: &str, jump_channel_id: &str, remind_type: RemindType, ) -> Result<Schedule>

Updates an existing schedule.

§Arguments
  • token - Authentication token
  • channel_id - The schedule channel ID
  • schedule_id - The schedule ID to update
  • name - New name of the schedule
  • start_timestamp - New start time as Unix timestamp string
  • end_timestamp - New end time as Unix timestamp string
  • jump_channel_id - New channel ID to jump to when event starts
  • remind_type - New type of reminder to set
§Returns

The updated schedule.

Source

pub async fn delete_schedule( &self, token: &Token, channel_id: &str, schedule_id: &str, ) -> Result<Value>

Deletes a schedule.

§Arguments
  • token - Authentication token
  • channel_id - The schedule channel ID
  • schedule_id - The schedule ID to delete
§Returns

Success indication.

Source

pub fn http(&self) -> &HttpClient

Gets the HTTP client reference.

Source

pub async fn close(&self)

Closes the API client and cleans up resources.

Trait Implementations§

Source§

impl Clone for BotApi

Source§

fn clone(&self) -> BotApi

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BotApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for BotApi

§

impl !RefUnwindSafe for BotApi

§

impl Send for BotApi

§

impl Sync for BotApi

§

impl Unpin for BotApi

§

impl !UnwindSafe for BotApi

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,