pub struct Selector {
pub user: Option<String>,
pub session: Option<String>,
pub host: Option<String>,
pub repo: Option<String>,
pub worktree: Option<String>,
pub claim: Option<String>,
pub lead: Option<bool>,
pub person: Option<bool>,
pub other: Option<Value>,
}Expand description
Picks sessions by who they are, where they work, and what they hold. Each field that is set must match. Set one or more fields.
The derive of serde is remote = "Self": it gives the read and the
write of the fields of this build as functions, and the impls below
add the selector other. So the tolerant reader holds this struct
itself, not a second copy of its fields (01M49W17GGV1K5FZEKJRPV0GNA).
Fields§
§user: Option<String>The user, for example mike.
session: Option<String>The session ID from the session part of a session URI.
host: Option<String>The host, for example pangolin.
repo: Option<String>The repository as OWNER/REPO, for example como-technologies/riff.
worktree: Option<String>The worktree, for example issue-6.
claim: Option<String>A claimed work item, for example issue-6.
lead: Option<bool>True picks the lead of its user in its repository. Use it with
user and repo.
person: Option<bool>True picks the terminals of a person: they have no session ID.
False picks the agent sessions. Use user=USER,person=true to
reach a person and no agent session of that person.
other: Option<Value>The JSON of a selector that this build does not know, as it came. Each field above is then empty, and the selector matches no session.
Implementations§
Source§impl<'de> Selector
impl<'de> Selector
pub fn deserialize<__D>(__deserializer: __D) -> Result<Selector, __D::Error>where
__D: Deserializer<'de>,
Source§impl Selector
impl Selector
Sourcepub fn is_other(&self) -> bool
pub fn is_other(&self) -> bool
True for a selector other: a selector that this build does not
know.
Sourcepub fn lead(user: &str, repo: &str) -> Self
pub fn lead(user: &str, repo: &str) -> Self
A selector for the lead of user in the repository repo.
Sourcepub fn matches(&self, uri: &SessionUri) -> bool
pub fn matches(&self, uri: &SessionUri) -> bool
True when each named field matches the session. A selector
other matches no session.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Selector
A build reads each selector that it does not know as a selector
other: an object with a field or a value that it does not know, and
each other form of JSON (01M3XSF90E9JYYTC13D9THY4WE).
impl<'de> Deserialize<'de> for Selector
A build reads each selector that it does not know as a selector
other: an object with a field or a value that it does not know, and
each other form of JSON (01M3XSF90E9JYYTC13D9THY4WE).
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl FromStr for Selector
impl FromStr for Selector
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses FIELD=VALUE pairs with commas between them.
use riff_core::selector::Selector;
let s: Selector = "user=mike,claim=issue-6".parse()?;
assert_eq!(s.to_string(), "user=mike,claim=issue-6");
let lead: Selector = "user=mike,lead=true".parse()?;
assert_eq!(lead.lead, Some(true));
let person: Selector = "user=mike,person=true".parse()?;
assert_eq!(person.person, Some(true));
assert!("lead=yes".parse::<Selector>().is_err());
assert!("person=yes".parse::<Selector>().is_err());
assert!("".parse::<Selector>().is_err());
assert!("colour=blue".parse::<Selector>().is_err());Source§impl JsonSchema for Selector
impl JsonSchema for Selector
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl Eq for Selector
impl StructuralPartialEq for Selector
Auto Trait Implementations§
impl Freeze for Selector
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnsafeUnpin for Selector
impl UnwindSafe for Selector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.