Trait json_api::value::fields::Segment [] [src]

pub trait Segment<T> {
    fn join(&self, other: T) -> Path;
}

Shared behavior for types that can be combined to create a Path.

Required Methods

Combines self with other. Returns a new Path.

Example

use json_api::value::fields::{Key, Path, Segment};

let posts = "posts".parse::<Key>()?;
let comments = "comments".parse::<Key>()?;

let path: Path = posts.join(&comments);
assert_eq!(path, "posts.comments");

let authors = "authors".parse::<Key>()?;
let name = "name".parse::<Key>()?;

let path: Path = path.join(&authors.join(&name));
assert_eq!(path, "posts.comments.authors.name");

Implementors