pub struct LocalPusher { /* private fields */ }Expand description
Encrypt + push + local write-through for clips originating on this device.
One per active relay. Cheap to clone (Arc inside) so it can be shared by
the clipboard polling loop and any other producer (e.g., a manual paste
command).
Implementations§
Source§impl LocalPusher
impl LocalPusher
pub fn new( store: Arc<Store>, client: Arc<RestClient>, enc_key: Option<[u8; 32]>, ) -> Self
Sourcepub async fn push_text(
&self,
raw: Vec<u8>,
source: &str,
label: &str,
content_type: ContentType,
) -> Result<PushOutcome, IngestError>
pub async fn push_text( &self, raw: Vec<u8>, source: &str, label: &str, content_type: ContentType, ) -> Result<PushOutcome, IngestError>
Encrypt + push a text clip, then write to the local store using the
relay-assigned ID. Returns PushOutcome::Synced(clip_id) on success,
or PushOutcome::Queued(local_id) when no encryption key is available
or the relay push fails with a transient error.
content_type is the canonical wire classification — one of
ContentType::Text, Url, or Code. Callers typically derive it
from classify::detect(&raw) (the raw bytes are accepted directly,
so callers do not need to UTF-8-validate up front).
Sourcepub async fn push_image_png(
&self,
raw_png: Vec<u8>,
source: &str,
label: &str,
) -> Result<PushOutcome, IngestError>
pub async fn push_image_png( &self, raw_png: Vec<u8>, source: &str, label: &str, ) -> Result<PushOutcome, IngestError>
Encrypt + push a PNG image, then write to the local store using the
relay-assigned ID. Returns PushOutcome::Synced(clip_id) on success,
or PushOutcome::Queued(local_id) when no encryption key is available
or the relay push fails with a transient error.
Trait Implementations§
Source§impl Clone for LocalPusher
impl Clone for LocalPusher
Source§fn clone(&self) -> LocalPusher
fn clone(&self) -> LocalPusher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more