volcengine_rust_sdk/volcengine/request/operation_config/operation_http_path.rs
1/*
2 * @Author: Jerry.Yang
3 * @Date: 2024-10-30 10:50:53
4 * @LastEditors: Jerry.Yang
5 * @LastEditTime: 2025-02-06 16:36:49
6 * @Description: operation http path
7 */
8
9/// Enum representing possible HTTP paths that can be used in API operations.
10/// This enum provides a type - safe way to specify the HTTP path for an API request.
11/// Currently, it only includes the `Default` path, which maps to the root path ("/").
12/// The `Debug` derive allows for easy debugging by providing a default implementation
13/// of the `fmt::Debug` trait, which enables printing the enum variants in a readable format.
14/// The `Clone` derive allows for creating copies of the enum values when needed.
15#[derive(Debug, Clone)]
16pub enum OperationHttpPath {
17 /// Represents the default HTTP path, which is the root path ("/").
18 /// This is typically used when no specific path is required for an API request.
19 Default,
20}
21
22/// Implementation of the `ToString` trait for the `OperationHttpPath` enum.
23/// This allows converting an instance of `OperationHttpPath` into a string representation.
24impl ToString for OperationHttpPath {
25 /// Converts an `OperationHttpPath` instance into a string.
26 ///
27 /// # Returns
28 /// - A `String` representing the HTTP path. For the `Default` variant, it returns "/".
29 fn to_string(&self) -> String {
30 match self {
31 // Map the `Default` variant to the root path ("/")
32 OperationHttpPath::Default => "/",
33 }
34 // Convert the string literal to a `String` type
35 .to_string()
36 }
37}
38
39/// Implementation of the `Default` trait for the `OperationHttpPath` enum.
40/// This provides a default value for the `OperationHttpPath` type.
41impl Default for OperationHttpPath {
42 /// Returns the default value for `OperationHttpPath`.
43 ///
44 /// # Returns
45 /// - An instance of `OperationHttpPath::Default`, which represents the root path ("/").
46 fn default() -> Self {
47 OperationHttpPath::Default
48 }
49}