pub struct Registry { /* private fields */ }Implementations§
Source§impl Registry
impl Registry
Sourcepub fn register(
&self,
username: &str,
name: &str,
platform: &str,
device: &str,
tx: UnboundedSender<LinkCommand>,
wants_devices: bool,
) -> String
pub fn register( &self, username: &str, name: &str, platform: &str, device: &str, tx: UnboundedSender<LinkCommand>, wants_devices: bool, ) -> String
Add a client, replacing any earlier connection from the same device and account. Returns its id.
Sourcepub fn set_push(&self, username: &str, device: &str, token: &str, sandbox: bool)
pub fn set_push(&self, username: &str, device: &str, token: &str, sandbox: bool)
Record where Apple’s push service reaches this device.
Sourcepub fn disconnect(&self, username: &str)
pub fn disconnect(&self, username: &str)
Close every link username has open. Dropping an entry’s sender ends
its session, and the client must then sign in again to reconnect.
pub fn unregister(&self, id: &str)
Sourcepub fn watch_levels(
&self,
username: &str,
watcher: &str,
target: &str,
on: bool,
)
pub fn watch_levels( &self, username: &str, watcher: &str, target: &str, on: bool, )
watcher has target’s playing bars on screen, or no longer has. The
target is told to send its levels while anyone watches, and to stop
when the last one goes. Only over a live link: levels are no reason to
wake a phone or to queue a command for later.
Sourcepub fn levels(&self, username: &str, from: &str, f: Frame)
pub fn levels(&self, username: &str, from: &str, f: Frame)
A frame of from’s levels, for each device watching it. Not stored:
one that cannot be delivered now is of no use later.
Let grantee control owner’s device device, or stop letting it.
Asked by the device itself; the caller has checked grantee is an
account on this server.
Tell owner’s device device whom it is shared with, and why its last
request was refused, if it was.
Sourcepub fn seen_at(&self, device: &str, username: &str, addr: IpAddr)
pub fn seen_at(&self, device: &str, username: &str, addr: IpAddr)
device, of username’s, linked from addr.
Sourcepub fn wake(&self, username: &str, from: &str, to: &str, notify: bool)
pub fn wake(&self, username: &str, from: &str, to: &str, notify: bool)
Wake to, one of username’s devices that is not linked, for from
(a device id), which chose it: with a background push, or with
notify a notification asking to be tapped. Logged with the push’s
round trip, and remembered so the link that follows is logged with how
long it took.
Sourcepub fn forget(&self, username: &str, device: &str) -> Result<(), String>
pub fn forget(&self, username: &str, device: &str) -> Result<(), String>
Forget device, one of username’s that is not linked: what the
server keeps of it, its push token included, so nothing is pushed to
it again; and every linked device of the account drops it. Another
account’s device is out of reach of this, by construction: every
record is keyed by account. A device that links again is recorded
afresh.
Sourcepub fn relay(
&self,
username: &str,
to: &str,
command: LinkCommand,
) -> Result<ClientInfo, String>
pub fn relay( &self, username: &str, to: &str, command: LinkCommand, ) -> Result<ClientInfo, String>
Relay command from one of username’s devices to another, to.
Sourcepub fn relay_from(
&self,
username: &str,
from: Option<&str>,
to: &str,
command: LinkCommand,
) -> Result<ClientInfo, String>
pub fn relay_from( &self, username: &str, from: Option<&str>, to: &str, command: LinkCommand, ) -> Result<ClientInfo, String>
relay, knowing which of username’s devices, from, sent it: what
lets a device shared with another account hand its music to that
account’s device, the one way a grant runs backwards.
Sourcepub fn set_activity(
&self,
username: &str,
watcher: &str,
activity: Option<(String, String, bool)>,
)
pub fn set_activity( &self, username: &str, watcher: &str, activity: Option<(String, String, bool)>, )
Where to push a Live Activity’s updates: watcher shows target.
None ends it.
Sourcepub fn list(&self, username: Option<&str>) -> Vec<ClientInfo>
pub fn list(&self, username: Option<&str>) -> Vec<ClientInfo>
Clients username may command, newest first; every client for None.
Sourcepub fn send(
&self,
username: Option<&str>,
id: Option<&str>,
cmd: LinkCommand,
) -> Result<ClientInfo, String>
pub fn send( &self, username: Option<&str>, id: Option<&str>, cmd: LinkCommand, ) -> Result<ClientInfo, String>
Send to id (an id or a name), or with none to the client the
command most likely means: the one playing, else the one that played
within RECENT, else the only one linked. Err names the choices when
there is no telling, so whoever asked can ask the person.
Source§impl Registry
impl Registry
Source§impl Registry
impl Registry
Sourcepub fn deliver(
&self,
username: Option<&str>,
cmd: LinkCommand,
) -> (Vec<String>, Vec<String>)
pub fn deliver( &self, username: Option<&str>, cmd: LinkCommand, ) -> (Vec<String>, Vec<String>)
Send to every device username may command: at once to those linked,
and to those that have linked before but are away now, when they next
link. For commands still right hours later (Sync, Evict), never
playback. The names reached now, and the names it waits for.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);