pub struct Url(pub(crate) Url);
Expand description
The URL used for connecting to a NetHSM instance.
Wraps url::Url
but offers stricter constraints. The URL
- must use https
- must have a host
- must not contain a password, user or query
Tuple Fields§
§0: Url
Implementations§
source§impl Url
impl Url
sourcepub fn new(url: &str) -> Result<Self, Error>
pub fn new(url: &str) -> Result<Self, Error>
Creates a new Url.
§Examples
use nethsm::Url;
Url::new("https://example.org/api/v1").is_ok();
Url::new("https://127.0.0.1:8443/api/v1").is_ok();
// errors when not using https
Url::new("http://example.org/api/v1").is_err();
// errors when using query, user or password
Url::new("https://example.org/api/v1?something").is_err();
§Errors
Returns an error if
- https is not used
- a host is not defined
- the URL contains a password, user or query
Trait Implementations§
source§impl<'de> Deserialize<'de> for Url
impl<'de> Deserialize<'de> for Url
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Url
impl StructuralPartialEq for Url
Auto Trait Implementations§
impl Freeze for Url
impl RefUnwindSafe for Url
impl Send for Url
impl Sync for Url
impl Unpin for Url
impl UnwindSafe for Url
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)