Skip to main content

InstanceOperationService

Struct InstanceOperationService 

Source
pub struct InstanceOperationService<'a> { /* private fields */ }
Expand description

实例操作相关服务

Implementations§

Source§

impl<'a> InstanceOperationService<'a>

Source

pub fn new(client: &'a TencentCloudClient) -> Self

创建新的实例操作服务

Examples found in repository?
examples/instance_terminate.rs (line 19)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9    // 从环境变量读取密钥
10    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
11        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
12    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
14
15    // 创建客户端
16    let client = TencentCloudClient::new(secret_id, secret_key);
17    
18    // 创建实例操作服务
19    let instance_operation_service = InstanceOperationService::new(&client);
20    
21    // 设置区域
22    let region = "ap-guangzhou";
23    
24    // 获取要退还的实例ID,可以从命令行参数传入
25    let instance_ids: Vec<String> = env::args()
26        .skip(1)  // 跳过程序名称
27        .collect();
28    
29    if instance_ids.is_empty() {
30        eprintln!("请提供至少一个实例ID作为命令行参数");
31        eprintln!("用法: cargo run --example instance_terminate <实例ID1> [<实例ID2> ...]");
32        return Ok(());
33    }
34    
35    // 确认是否继续
36    println!("将退还以下实例:");
37    for id in &instance_ids {
38        println!("- {}", id);
39    }
40    println!("警告: 这个操作不可逆!按量计费实例将被直接销毁,包年包月实例将被移至回收站。");
41    println!("是否继续?[y/N]");
42    
43    let mut input = String::new();
44    std::io::stdin().read_line(&mut input)?;
45    
46    if input.trim().to_lowercase() != "y" {
47        println!("操作已取消");
48        return Ok(());
49    }
50    
51    // 创建退还实例请求
52    let request = TerminateInstancesRequest {
53        InstanceIds: instance_ids,
54        ReleasePrepaidDataDisks: Some(false),  // 默认不释放包年包月数据盘
55    };
56    
57    // 发送退还请求
58    println!("正在退还实例...");
59    match instance_operation_service.terminate_instances(&request, region).await {
60        Ok(_) => {
61            println!("实例退还请求已提交成功");
62            println!("按量计费实例将被直接销毁,包年包月实例将被移至回收站");
63        },
64        Err(err) => {
65            println!("退还实例失败: {}", err);
66        }
67    }
68    
69    Ok(())
70}
More examples
Hide additional examples
examples/instance_lifecycle.rs (line 21)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    // 从环境变量读取密钥
12    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
14    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
15        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
16
17    // 创建客户端
18    let client = TencentCloudClient::new(secret_id, secret_key);
19    
20    // 创建实例操作服务
21    let instance_operation_service = InstanceOperationService::new(&client);
22    
23    // 设置区域
24    let region = "ap-guangzhou";
25    
26    // 获取要操作的实例ID
27    let args: Vec<String> = env::args().collect();
28    if args.len() < 3 {
29        eprintln!("用法: cargo run --example instance_lifecycle <操作> <实例ID1> [<实例ID2> ...]");
30        eprintln!("操作可以是: start, stop, reboot");
31        return Ok(());
32    }
33    
34    let operation = &args[1];
35    let instance_ids: Vec<String> = args[2..].iter().cloned().collect();
36    
37    // 确认是否继续
38    println!("将对以下实例执行{}操作:", operation);
39    for id in &instance_ids {
40        println!("- {}", id);
41    }
42    println!("是否继续?[y/N]");
43    
44    let mut input = String::new();
45    std::io::stdin().read_line(&mut input)?;
46    
47    if input.trim().to_lowercase() != "y" {
48        println!("操作已取消");
49        return Ok(());
50    }
51    
52    match operation.as_str() {
53        "start" => {
54            // 创建启动实例请求
55            let request = StartInstancesRequest {
56                InstanceIds: instance_ids,
57            };
58            
59            // 发送启动请求
60            println!("正在启动实例...");
61            match instance_operation_service.start_instances(&request, region).await {
62                Ok(_) => {
63                    println!("实例启动请求已提交成功");
64                    println!("实例将从STOPPED状态变为STARTING状态,然后再变为RUNNING状态");
65                },
66                Err(err) => {
67                    println!("启动实例失败: {}", err);
68                }
69            }
70        },
71        "stop" => {
72            // 创建关闭实例请求
73            let request = StopInstancesRequest {
74                InstanceIds: instance_ids,
75                StopType: Some("SOFT".to_string()),  // 软关机
76                ForceStop: None,  // 弃用的参数
77                StoppedMode: Some("KEEP_CHARGING".to_string()),  // 关机继续收费
78            };
79            
80            // 发送关闭请求
81            println!("正在关闭实例...");
82            match instance_operation_service.stop_instances(&request, region).await {
83                Ok(_) => {
84                    println!("实例关闭请求已提交成功");
85                    println!("实例将从RUNNING状态变为STOPPING状态,然后再变为STOPPED状态");
86                },
87                Err(err) => {
88                    println!("关闭实例失败: {}", err);
89                }
90            }
91        },
92        "reboot" => {
93            // 创建重启实例请求
94            let request = RebootInstancesRequest {
95                InstanceIds: instance_ids,
96                StopType: Some("SOFT".to_string()),  // 软重启
97                ForceReboot: None,  // 弃用的参数
98            };
99            
100            // 发送重启请求
101            println!("正在重启实例...");
102            match instance_operation_service.reboot_instances(&request, region).await {
103                Ok(_) => {
104                    println!("实例重启请求已提交成功");
105                    println!("实例将从RUNNING状态变为REBOOTING状态,然后再变为RUNNING状态");
106                },
107                Err(err) => {
108                    println!("重启实例失败: {}", err);
109                }
110            }
111        },
112        _ => {
113            eprintln!("未知操作: {}", operation);
114            eprintln!("支持的操作: start, stop, reboot");
115        }
116    }
117    
118    Ok(())
119}
Source

pub async fn start_instances( &self, request: &StartInstancesRequest, region: &str, ) -> Result<StartInstancesResponseType>

启动实例

本接口 (StartInstances) 用于启动一个或多个实例。

  • 只有状态为STOPPED的实例才可以进行此操作。
  • 接口调用成功时,实例会进入STARTING状态;启动实例成功时,实例会进入RUNNING状态。
  • 本接口为异步接口,启动实例请求发送成功后会返回一个RequestId,此时操作并未立即完成。
Examples found in repository?
examples/instance_lifecycle.rs (line 61)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    // 从环境变量读取密钥
12    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
14    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
15        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
16
17    // 创建客户端
18    let client = TencentCloudClient::new(secret_id, secret_key);
19    
20    // 创建实例操作服务
21    let instance_operation_service = InstanceOperationService::new(&client);
22    
23    // 设置区域
24    let region = "ap-guangzhou";
25    
26    // 获取要操作的实例ID
27    let args: Vec<String> = env::args().collect();
28    if args.len() < 3 {
29        eprintln!("用法: cargo run --example instance_lifecycle <操作> <实例ID1> [<实例ID2> ...]");
30        eprintln!("操作可以是: start, stop, reboot");
31        return Ok(());
32    }
33    
34    let operation = &args[1];
35    let instance_ids: Vec<String> = args[2..].iter().cloned().collect();
36    
37    // 确认是否继续
38    println!("将对以下实例执行{}操作:", operation);
39    for id in &instance_ids {
40        println!("- {}", id);
41    }
42    println!("是否继续?[y/N]");
43    
44    let mut input = String::new();
45    std::io::stdin().read_line(&mut input)?;
46    
47    if input.trim().to_lowercase() != "y" {
48        println!("操作已取消");
49        return Ok(());
50    }
51    
52    match operation.as_str() {
53        "start" => {
54            // 创建启动实例请求
55            let request = StartInstancesRequest {
56                InstanceIds: instance_ids,
57            };
58            
59            // 发送启动请求
60            println!("正在启动实例...");
61            match instance_operation_service.start_instances(&request, region).await {
62                Ok(_) => {
63                    println!("实例启动请求已提交成功");
64                    println!("实例将从STOPPED状态变为STARTING状态,然后再变为RUNNING状态");
65                },
66                Err(err) => {
67                    println!("启动实例失败: {}", err);
68                }
69            }
70        },
71        "stop" => {
72            // 创建关闭实例请求
73            let request = StopInstancesRequest {
74                InstanceIds: instance_ids,
75                StopType: Some("SOFT".to_string()),  // 软关机
76                ForceStop: None,  // 弃用的参数
77                StoppedMode: Some("KEEP_CHARGING".to_string()),  // 关机继续收费
78            };
79            
80            // 发送关闭请求
81            println!("正在关闭实例...");
82            match instance_operation_service.stop_instances(&request, region).await {
83                Ok(_) => {
84                    println!("实例关闭请求已提交成功");
85                    println!("实例将从RUNNING状态变为STOPPING状态,然后再变为STOPPED状态");
86                },
87                Err(err) => {
88                    println!("关闭实例失败: {}", err);
89                }
90            }
91        },
92        "reboot" => {
93            // 创建重启实例请求
94            let request = RebootInstancesRequest {
95                InstanceIds: instance_ids,
96                StopType: Some("SOFT".to_string()),  // 软重启
97                ForceReboot: None,  // 弃用的参数
98            };
99            
100            // 发送重启请求
101            println!("正在重启实例...");
102            match instance_operation_service.reboot_instances(&request, region).await {
103                Ok(_) => {
104                    println!("实例重启请求已提交成功");
105                    println!("实例将从RUNNING状态变为REBOOTING状态,然后再变为RUNNING状态");
106                },
107                Err(err) => {
108                    println!("重启实例失败: {}", err);
109                }
110            }
111        },
112        _ => {
113            eprintln!("未知操作: {}", operation);
114            eprintln!("支持的操作: start, stop, reboot");
115        }
116    }
117    
118    Ok(())
119}
Source

pub async fn reboot_instances( &self, request: &RebootInstancesRequest, region: &str, ) -> Result<RebootInstancesResponseType>

重启实例

本接口 (RebootInstances) 用于重启实例。

  • 只有状态为RUNNING的实例才可以进行此操作。
  • 接口调用成功时,实例会进入REBOOTING状态;重启实例成功时,实例会进入RUNNING状态。
  • 支持强制重启,强制重启可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常重启时使用。
Examples found in repository?
examples/instance_lifecycle.rs (line 102)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    // 从环境变量读取密钥
12    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
14    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
15        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
16
17    // 创建客户端
18    let client = TencentCloudClient::new(secret_id, secret_key);
19    
20    // 创建实例操作服务
21    let instance_operation_service = InstanceOperationService::new(&client);
22    
23    // 设置区域
24    let region = "ap-guangzhou";
25    
26    // 获取要操作的实例ID
27    let args: Vec<String> = env::args().collect();
28    if args.len() < 3 {
29        eprintln!("用法: cargo run --example instance_lifecycle <操作> <实例ID1> [<实例ID2> ...]");
30        eprintln!("操作可以是: start, stop, reboot");
31        return Ok(());
32    }
33    
34    let operation = &args[1];
35    let instance_ids: Vec<String> = args[2..].iter().cloned().collect();
36    
37    // 确认是否继续
38    println!("将对以下实例执行{}操作:", operation);
39    for id in &instance_ids {
40        println!("- {}", id);
41    }
42    println!("是否继续?[y/N]");
43    
44    let mut input = String::new();
45    std::io::stdin().read_line(&mut input)?;
46    
47    if input.trim().to_lowercase() != "y" {
48        println!("操作已取消");
49        return Ok(());
50    }
51    
52    match operation.as_str() {
53        "start" => {
54            // 创建启动实例请求
55            let request = StartInstancesRequest {
56                InstanceIds: instance_ids,
57            };
58            
59            // 发送启动请求
60            println!("正在启动实例...");
61            match instance_operation_service.start_instances(&request, region).await {
62                Ok(_) => {
63                    println!("实例启动请求已提交成功");
64                    println!("实例将从STOPPED状态变为STARTING状态,然后再变为RUNNING状态");
65                },
66                Err(err) => {
67                    println!("启动实例失败: {}", err);
68                }
69            }
70        },
71        "stop" => {
72            // 创建关闭实例请求
73            let request = StopInstancesRequest {
74                InstanceIds: instance_ids,
75                StopType: Some("SOFT".to_string()),  // 软关机
76                ForceStop: None,  // 弃用的参数
77                StoppedMode: Some("KEEP_CHARGING".to_string()),  // 关机继续收费
78            };
79            
80            // 发送关闭请求
81            println!("正在关闭实例...");
82            match instance_operation_service.stop_instances(&request, region).await {
83                Ok(_) => {
84                    println!("实例关闭请求已提交成功");
85                    println!("实例将从RUNNING状态变为STOPPING状态,然后再变为STOPPED状态");
86                },
87                Err(err) => {
88                    println!("关闭实例失败: {}", err);
89                }
90            }
91        },
92        "reboot" => {
93            // 创建重启实例请求
94            let request = RebootInstancesRequest {
95                InstanceIds: instance_ids,
96                StopType: Some("SOFT".to_string()),  // 软重启
97                ForceReboot: None,  // 弃用的参数
98            };
99            
100            // 发送重启请求
101            println!("正在重启实例...");
102            match instance_operation_service.reboot_instances(&request, region).await {
103                Ok(_) => {
104                    println!("实例重启请求已提交成功");
105                    println!("实例将从RUNNING状态变为REBOOTING状态,然后再变为RUNNING状态");
106                },
107                Err(err) => {
108                    println!("重启实例失败: {}", err);
109                }
110            }
111        },
112        _ => {
113            eprintln!("未知操作: {}", operation);
114            eprintln!("支持的操作: start, stop, reboot");
115        }
116    }
117    
118    Ok(())
119}
Source

pub async fn stop_instances( &self, request: &StopInstancesRequest, region: &str, ) -> Result<StopInstancesResponseType>

关闭实例

本接口 (StopInstances) 用于关闭一个或多个实例。

  • 只有状态为RUNNING的实例才可以进行此操作。
  • 接口调用成功时,实例会进入STOPPING状态;关闭实例成功时,实例会进入STOPPED状态。
  • 支持强制关闭,强制关闭可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
  • 本接口为异步接口,关闭实例请求发送成功后会返回一个RequestId,此时操作并未立即完成。
Examples found in repository?
examples/instance_lifecycle.rs (line 82)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    // 从环境变量读取密钥
12    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
14    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
15        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
16
17    // 创建客户端
18    let client = TencentCloudClient::new(secret_id, secret_key);
19    
20    // 创建实例操作服务
21    let instance_operation_service = InstanceOperationService::new(&client);
22    
23    // 设置区域
24    let region = "ap-guangzhou";
25    
26    // 获取要操作的实例ID
27    let args: Vec<String> = env::args().collect();
28    if args.len() < 3 {
29        eprintln!("用法: cargo run --example instance_lifecycle <操作> <实例ID1> [<实例ID2> ...]");
30        eprintln!("操作可以是: start, stop, reboot");
31        return Ok(());
32    }
33    
34    let operation = &args[1];
35    let instance_ids: Vec<String> = args[2..].iter().cloned().collect();
36    
37    // 确认是否继续
38    println!("将对以下实例执行{}操作:", operation);
39    for id in &instance_ids {
40        println!("- {}", id);
41    }
42    println!("是否继续?[y/N]");
43    
44    let mut input = String::new();
45    std::io::stdin().read_line(&mut input)?;
46    
47    if input.trim().to_lowercase() != "y" {
48        println!("操作已取消");
49        return Ok(());
50    }
51    
52    match operation.as_str() {
53        "start" => {
54            // 创建启动实例请求
55            let request = StartInstancesRequest {
56                InstanceIds: instance_ids,
57            };
58            
59            // 发送启动请求
60            println!("正在启动实例...");
61            match instance_operation_service.start_instances(&request, region).await {
62                Ok(_) => {
63                    println!("实例启动请求已提交成功");
64                    println!("实例将从STOPPED状态变为STARTING状态,然后再变为RUNNING状态");
65                },
66                Err(err) => {
67                    println!("启动实例失败: {}", err);
68                }
69            }
70        },
71        "stop" => {
72            // 创建关闭实例请求
73            let request = StopInstancesRequest {
74                InstanceIds: instance_ids,
75                StopType: Some("SOFT".to_string()),  // 软关机
76                ForceStop: None,  // 弃用的参数
77                StoppedMode: Some("KEEP_CHARGING".to_string()),  // 关机继续收费
78            };
79            
80            // 发送关闭请求
81            println!("正在关闭实例...");
82            match instance_operation_service.stop_instances(&request, region).await {
83                Ok(_) => {
84                    println!("实例关闭请求已提交成功");
85                    println!("实例将从RUNNING状态变为STOPPING状态,然后再变为STOPPED状态");
86                },
87                Err(err) => {
88                    println!("关闭实例失败: {}", err);
89                }
90            }
91        },
92        "reboot" => {
93            // 创建重启实例请求
94            let request = RebootInstancesRequest {
95                InstanceIds: instance_ids,
96                StopType: Some("SOFT".to_string()),  // 软重启
97                ForceReboot: None,  // 弃用的参数
98            };
99            
100            // 发送重启请求
101            println!("正在重启实例...");
102            match instance_operation_service.reboot_instances(&request, region).await {
103                Ok(_) => {
104                    println!("实例重启请求已提交成功");
105                    println!("实例将从RUNNING状态变为REBOOTING状态,然后再变为RUNNING状态");
106                },
107                Err(err) => {
108                    println!("重启实例失败: {}", err);
109                }
110            }
111        },
112        _ => {
113            eprintln!("未知操作: {}", operation);
114            eprintln!("支持的操作: start, stop, reboot");
115        }
116    }
117    
118    Ok(())
119}
Source

pub async fn reset_instances_password( &self, request: &ResetInstancesPasswordRequest, region: &str, ) -> Result<ResetInstancesPasswordResponseType>

重置实例密码

本接口 (ResetInstancesPassword) 用于将实例操作系统的密码重置为用户指定的密码。

  • 只有状态为RUNNING或STOPPED的实例才可以进行此操作。
  • 批量操作的每个实例的重置密码结果可能不同,具体操作结果可以通过调用 DescribeInstances 接口查询。
  • 本接口为异步接口,重置密码请求发送成功后会返回一个RequestId,此时操作并未立即完成。
Source

pub async fn modify_instances_attribute( &self, request: &ModifyInstancesAttributeRequest, region: &str, ) -> Result<ModifyInstancesAttributeResponseType>

修改实例的属性

本接口 (ModifyInstancesAttribute) 用于修改实例的属性(目前只支持修改实例的名称)。

  • 批量操作的每个实例的修改属性结果可能不同,具体操作结果可以通过调用 DescribeInstances 接口查询。
Source

pub async fn renew_instances( &self, request: &RenewInstancesRequest, region: &str, ) -> Result<RenewInstancesResponseType>

续费实例

本接口 (RenewInstances) 用于续费包年包月实例。

  • 只支持操作包年包月实例。
  • 批量续费实例的续费时间将以所有实例中最短的剩余时间为准。例如,三个实例分别有1个月、2个月、3个月的剩余时间,续费2个月,则1个月的实例续费后剩余时间为3个月,2个月的实例续费后剩余时间为4个月,3个月的实例续费后剩余时间为5个月。
Source

pub async fn reset_instance( &self, request: &ResetInstanceRequest, region: &str, ) -> Result<ResetInstanceResponseType>

重装实例

本接口 (ResetInstance) 用于重装指定实例上的操作系统。

  • 如果指定了ImageId参数,则使用指定的镜像重装;否则按照系统默认值进行重装。
  • 系统盘将会被格式化,并重置为指定的操作系统,其中数据盘的数据将保留不做处理。
  • 只有状态为RUNNING或者STOPPED的实例才可以进行此操作。
Source

pub async fn terminate_instances( &self, request: &TerminateInstancesRequest, region: &str, ) -> Result<TerminateInstancesResponseType>

退还实例

本接口(TerminateInstances)用于主动退还实例。

  • 不再使用的实例,可通过本接口主动退还。
  • 按量计费的实例通过本接口可直接退还;包年包月实例如符合退还规则,也可通过本接口主动退还。
  • 包年包月实例首次调用本接口,实例将被移至回收站,再次调用本接口,实例将被销毁,且不可恢复。按量计费实例调用本接口将被直接销毁。
Examples found in repository?
examples/instance_terminate.rs (line 59)
8async fn main() -> Result<(), Box<dyn std::error::Error>> {
9    // 从环境变量读取密钥
10    let secret_id = env::var("TENCENTCLOUD_SECRET_ID")
11        .expect("请设置环境变量TENCENTCLOUD_SECRET_ID");
12    let secret_key = env::var("TENCENTCLOUD_SECRET_KEY")
13        .expect("请设置环境变量TENCENTCLOUD_SECRET_KEY");
14
15    // 创建客户端
16    let client = TencentCloudClient::new(secret_id, secret_key);
17    
18    // 创建实例操作服务
19    let instance_operation_service = InstanceOperationService::new(&client);
20    
21    // 设置区域
22    let region = "ap-guangzhou";
23    
24    // 获取要退还的实例ID,可以从命令行参数传入
25    let instance_ids: Vec<String> = env::args()
26        .skip(1)  // 跳过程序名称
27        .collect();
28    
29    if instance_ids.is_empty() {
30        eprintln!("请提供至少一个实例ID作为命令行参数");
31        eprintln!("用法: cargo run --example instance_terminate <实例ID1> [<实例ID2> ...]");
32        return Ok(());
33    }
34    
35    // 确认是否继续
36    println!("将退还以下实例:");
37    for id in &instance_ids {
38        println!("- {}", id);
39    }
40    println!("警告: 这个操作不可逆!按量计费实例将被直接销毁,包年包月实例将被移至回收站。");
41    println!("是否继续?[y/N]");
42    
43    let mut input = String::new();
44    std::io::stdin().read_line(&mut input)?;
45    
46    if input.trim().to_lowercase() != "y" {
47        println!("操作已取消");
48        return Ok(());
49    }
50    
51    // 创建退还实例请求
52    let request = TerminateInstancesRequest {
53        InstanceIds: instance_ids,
54        ReleasePrepaidDataDisks: Some(false),  // 默认不释放包年包月数据盘
55    };
56    
57    // 发送退还请求
58    println!("正在退还实例...");
59    match instance_operation_service.terminate_instances(&request, region).await {
60        Ok(_) => {
61            println!("实例退还请求已提交成功");
62            println!("按量计费实例将被直接销毁,包年包月实例将被移至回收站");
63        },
64        Err(err) => {
65            println!("退还实例失败: {}", err);
66        }
67    }
68    
69    Ok(())
70}

Auto Trait Implementations§

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> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<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