Struct remote_clipboard::Clipboard[][src]

pub struct Clipboard {
    pub config: ConfigContext,
}

Fields

config: ConfigContext

Implementations

impl Clipboard[src]

pub fn from(config: ConfigContext) -> Clipboard[src]

pub fn copy(&self, input: &mut dyn Read) -> Result<(), ClipboardError>[src]

Push readable data into the remote clipboard

Arguments

  • input - A readable object

Example

use remote_clipboard as rclip;
use std::path::PathBuf;
use url::Url;
let clipboard = rclip::Clipboard::from(rclip::config::ConfigContext {
    config_path: PathBuf::from("/blah"),
    base_url: url::Url::parse("https://toto.com").unwrap(),
    token: String::from("token"),
    namespace: String::from("namespace"),
});
//clipboard.copy(&mut "toto".as_bytes());

pub fn copy_comp(
    &self,
    input: &mut dyn Read,
    completion: Box<dyn Fn(Result<(), ClipboardError>)>
) -> Result<(), ClipboardError>
[src]

pub fn paste(&self, output: &mut dyn Write) -> Result<(), ClipboardError>[src]

Pull data from the remote clipboard

Example

use remote_clipboard as rclip;
use std::io::{self};
use std::path::PathBuf;
use url::Url;
let clipboard = rclip::Clipboard::from(rclip::config::ConfigContext {
    config_path: PathBuf::from("/blah"),
    base_url: url::Url::parse("https://toto.com").unwrap(),
    token: String::from("token"),
    namespace: String::from("namespace"),
});
let stdout = io::stdout();
//clipboard.paste(&mut stdout.lock());

pub fn paste_comp(
    &self,
    completion: Box<dyn Fn(Result<String, ClipboardError>)>
) -> Result<(), ClipboardError>
[src]

pub fn open(&mut self) -> Result<(), ClipboardError>[src]

Open a new remote clipboard And generate new token if needed The function is synchronous

Example

use remote_clipboard as rclip;
use std::path::PathBuf;
use url::Url;
let mut clipboard = rclip::Clipboard::from(rclip::config::ConfigContext {
    config_path: PathBuf::from("/blah"),
    base_url: url::Url::parse("https://toto.com").unwrap(),
    token: String::from("token"),
    namespace: String::from("namespace"),
});
//clipboard.open();

pub fn open_comp(
    &self,
    completion: Box<dyn Fn(Result<String, ClipboardError>)>
) -> Result<(), ClipboardError>
[src]

pub fn login(
    &mut self,
    email: &mut dyn Read,
    passwd: &mut dyn Read
) -> Result<(), ClipboardError>
[src]

pub fn login_comp(
    &self,
    email: &mut dyn Read,
    passwd: &mut dyn Read,
    completion: Box<dyn Fn(Result<String, ClipboardError>)>
) -> Result<(), ClipboardError>
[src]

Link against newly opened remote clipboard

Arguments

  • input - A readable object containing the short living hash

Example

use remote_clipboard as rclip;
use std::io::{self};
use std::path::PathBuf;
use url::Url;
let mut clipboard = rclip::Clipboard::from(rclip::config::ConfigContext {
    config_path: PathBuf::from("/blah"),
    base_url: url::Url::parse("https://toto.com").unwrap(),
    token: String::from("token"),
    namespace: String::from("namespace"),
});
//clipboard.link(&mut "012345".as_bytes());

TODO: check input size

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.