pub struct RelLink { /* private fields */ }Implementations§
Source§impl RelLink
impl RelLink
Sourcepub fn new(rel: &str, href: &str, method: HttpMethod) -> Self
pub fn new(rel: &str, href: &str, method: HttpMethod) -> Self
Constructs a new RelLink
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
let validate = ("somewhere_obj", "/somewhere/", HttpMethod::Get).into();
assert_eq!(rel, validate);Sourcepub fn href(&self) -> &str
pub fn href(&self) -> &str
§Getter for href
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
assert_eq!(rel.href(), "/somewhere/");Sourcepub fn href_mut(&mut self) -> &mut String
pub fn href_mut(&mut self) -> &mut String
§Getter/Setter for href
use hateoas::{HttpMethod, RelLink};
let mut rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
*(rel.href_mut()) = "/somewhere_else/".to_string();
assert_eq!(rel.href(), "/somewhere_else/");Sourcepub fn rel(&self) -> &str
pub fn rel(&self) -> &str
§Getter for rel
use hateoas::{HttpMethod, RelLink};
let mut rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
///
assert_eq!(rel.rel(), "somewhere_obj");Sourcepub fn rel_mut(&mut self) -> &mut String
pub fn rel_mut(&mut self) -> &mut String
§Getter/Setter for rel
use hateoas::{HttpMethod, RelLink};
let mut rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
*(rel.rel_mut()) = "somewhere_obj_2".to_string();
assert_eq!(rel.rel(), "somewhere_obj_2");Sourcepub fn method(&self) -> &HttpMethod
pub fn method(&self) -> &HttpMethod
§Getter for method
use hateoas::{HttpMethod, RelLink};
let mut rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get); ///
assert_eq!(rel.method(), &HttpMethod::Get);Sourcepub fn method_mut(&mut self) -> &mut HttpMethod
pub fn method_mut(&mut self) -> &mut HttpMethod
§Getter/Setter for rel
use hateoas::{HttpMethod, RelLink};
let mut rel = RelLink::new( "somewhere_obj","/somewhere/", HttpMethod::Get);
*(rel.method_mut()) = HttpMethod::Connect;
assert_eq!(rel.method(), &HttpMethod::Connect);Source§impl RelLink
impl RelLink
Sourcepub fn GET(rel: &str, href: &str) -> RelLink
pub fn GET(rel: &str, href: &str) -> RelLink
The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::GET("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Get));Sourcepub fn HEAD(rel: &str, href: &str) -> RelLink
pub fn HEAD(rel: &str, href: &str) -> RelLink
The HEAD method asks for a response identical to a GET request, but without the response body.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::HEAD("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Head));Sourcepub fn POST(rel: &str, href: &str) -> RelLink
pub fn POST(rel: &str, href: &str) -> RelLink
The POST method submits an entity to the specified resource, often causing a change in state or side effects on the server.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::POST("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Post));Sourcepub fn PUT(rel: &str, href: &str) -> RelLink
pub fn PUT(rel: &str, href: &str) -> RelLink
The PUT method replaces all current representations of the target resource with the request payload.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::PUT("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Put));Sourcepub fn DELETE(rel: &str, href: &str) -> RelLink
pub fn DELETE(rel: &str, href: &str) -> RelLink
The DELETE method deletes the specified resource.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::DELETE("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Delete));Sourcepub fn CONNECT(rel: &str, href: &str) -> RelLink
pub fn CONNECT(rel: &str, href: &str) -> RelLink
The CONNECT method establishes a tunnel to the server identified by the target resource.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::CONNECT("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Connect));Sourcepub fn OPTIONS(rel: &str, href: &str) -> RelLink
pub fn OPTIONS(rel: &str, href: &str) -> RelLink
The OPTIONS method describes the communication options for the target resource.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::OPTIONS("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Options));Sourcepub fn TRACE(rel: &str, href: &str) -> RelLink
pub fn TRACE(rel: &str, href: &str) -> RelLink
The TRACE method performs a message loop-back test along the path to the target resource.
use hateoas::{HttpMethod, RelLink};
let rel = RelLink::TRACE("object", "/path/to/objects");
assert_eq!(rel, RelLink::new("object", "/path/to/objects", HttpMethod::Trace));