ali_oss/types/
bucket_location.rs1#[derive(Debug, Clone)]
2pub struct BucketLocation(String);
3
4impl AsRef<str> for BucketLocation {
5 fn as_ref(&self) -> &str {
6 &self.0
7 }
8}
9
10impl BucketLocation {
11 pub fn new<T: ToString>(location: T) -> Self {
12 Self(location.to_string())
13 }
14 pub fn new_from_xml_node(node: roxmltree::Node) -> anyhow::Result<Self> {
15 let location = node.descendants().find(|n| n.has_tag_name("LocationConstraint")).and_then(|node| node.text()).unwrap_or("");
16 Ok(Self(location.to_string()))
17 }
18 pub fn as_str(&self) -> &str {
19 &self.0
20 }
21}