use syn::{self, Path};
#[derive(Debug, Clone, Copy, Default)]
pub struct Bindings {
pub no_std: bool,
}
impl Bindings {
pub fn string_ty(&self) -> Path {
syn::parse_str(if self.no_std {
"::alloc::string::String"
} else {
"::std::string::String"
}).unwrap()
}
pub fn result_ty(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::result::Result"
} else {
"::std::result::Result"
}).unwrap()
}
pub fn option_ty(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::option::Option"
} else {
"::std::option::Option"
}).unwrap()
}
pub fn phantom_data_ty(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::marker::PhantomData"
} else {
"::std::marker::PhantomData"
}).unwrap()
}
pub fn default_trait(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::default::Default"
} else {
"::std::default::Default"
}).unwrap()
}
pub fn clone_trait(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::clone::Clone"
} else {
"::std::clone::Clone"
}).unwrap()
}
#[cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))]
pub fn into_trait(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::convert::Into"
} else {
"::std::convert::Into"
}).unwrap()
}
pub fn try_into_trait(&self) -> Path {
syn::parse_str(if self.no_std {
"::core::convert::TryInto"
} else {
"::std::convert::TryInto"
}).unwrap()
}
}