[][src]Struct remote_clipboard::Clipboard

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"),
});
clipboard.copy(&mut "toto".as_bytes());

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"),
});
let stdout = io::stdout();
clipboard.paste(&mut stdout.lock());

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

Open a new remote clipboard and display a short living hash for linking another client.

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"),
});
clipboard.open();

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"),
});
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, 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.