Skip to main content

Point

Struct Point 

Source
pub struct Point {
    pub x: Option<f64>,
    pub y: Option<f64>,
    pub at: Option<String>,
    pub query: Option<String>,
    pub display_id: DisplayId,
    pub label: Option<String>,
    pub ttl_ms: Option<u64>,
}
Expand description

Put the orb on a target.

Two forms. Clients that ground coordinates themselves send x and y. Clients that cannot send query instead, which needs a configured resolver.

Fields§

§x: Option<f64>

Horizontal position in logical points. Paired with y.

§y: Option<f64>

Vertical position in logical points. Paired with x.

§at: Option<String>

A position named relative to the display, such as top-left or 50%,30%.

For clients that have not measured the screen and so cannot name a coordinate. Resolved by the daemon, which is the only party that knows the geometry.

§query: Option<String>

Natural language description of the target, resolved by the daemon.

§display_id: DisplayId

The display the coordinates, position, or query apply to.

§label: Option<String>

Short caption rendered next to the orb.

§ttl_ms: Option<u64>

How long the mark should live, in milliseconds.

Omit to draw until cleared, invalidated, or the session ends.

Implementations§

Source§

impl Point

Source

pub const fn at(x: f64, y: f64, display_id: DisplayId) -> Self

At explicit coordinates.

Source

pub fn query(query: impl Into<String>, display_id: DisplayId) -> Self

From a natural language description. Requires a resolver.

Source

pub fn named(at: impl Into<String>, display_id: DisplayId) -> Self

At a position named relative to the display, such as top-left or 50%,30%.

Source

pub fn with_label(self, label: impl Into<String>) -> Self

Attach a caption.

Source

pub fn with_ttl_ms(self, ttl_ms: Option<u64>) -> Self

Set how long the mark lives, in milliseconds.

Source

pub fn target(&self) -> Result<PointTarget<'_>, ValidationError>

Which form was sent.

Exactly one of the three. Half a coordinate pair, or two forms at once, is an error rather than a guess: every one of those is a client bug, and drawing somewhere plausible would hide it.

Trait Implementations§

Source§

impl Clone for Point

Source§

fn clone(&self) -> Point

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Point

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Point

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Point

Source§

fn eq(&self, other: &Point) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Point

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Point

Source§

impl Validate for Point

Source§

fn validate(&self) -> Result<(), ValidationError>

Check the message. Called by the daemon before anything is rendered.

Auto Trait Implementations§

§

impl Freeze for Point

§

impl RefUnwindSafe for Point

§

impl Send for Point

§

impl Sync for Point

§

impl Unpin for Point

§

impl UnsafeUnpin for Point

§

impl UnwindSafe for Point

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.