Skip to content

Commit

Permalink
Fix syntax in osx_clipboard.rs. Change comment position in `.travis…
Browse files Browse the repository at this point in the history
….yml` (for some reason the apt-get line tried to run on Travis OSX, even though it's commented).
  • Loading branch information
aweinstock314 committed Mar 9, 2017
1 parent ea998e1 commit f569f77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ sudo: required
matrix:
include:
- os: osx
## TODO: figure out how to get headless X11 working
#- install:
# - sudo apt-get install xorg-dev
# # TODO: figure out how to get headless X11 working
# - install:
# - sudo apt-get install xorg-dev
6 changes: 3 additions & 3 deletions src/osx_clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct OSXClipboardContext {
extern {}

impl ClipboardProvider for OSXClipboardContext {
pub fn new() -> Result<OSXClipboardContext, Box<Error>> {
fn new() -> Result<OSXClipboardContext, Box<Error>> {
let cls = try!(Class::get("NSPasteboard").ok_or(err("Class::get(\"NSPasteboard\")")));
let pasteboard: *mut Object = unsafe { msg_send![cls, generalPasteboard] };
if pasteboard.is_null() {
Expand All @@ -42,7 +42,7 @@ impl ClipboardProvider for OSXClipboardContext {
pasteboard: pasteboard,
})
}
pub fn get_contents(&mut self) -> Result<String, Box<Error>> {
fn get_contents(&mut self) -> Result<String, Box<Error>> {
let string_class: Id<NSObject> = {
let cls: Id<Class> = unsafe { Id::from_ptr(class("NSString")) };
unsafe { transmute(cls) }
Expand All @@ -62,7 +62,7 @@ impl ClipboardProvider for OSXClipboardContext {
Ok(string_array[0].as_str().to_owned())
}
}
pub fn set_contents(&mut self, data: String) -> Result<(), Box<Error>> {
fn set_contents(&mut self, data: String) -> Result<(), Box<Error>> {
let string_array = NSArray::from_vec(vec![NSString::from_str(&data)]);
let _: usize = unsafe { msg_send![self.pasteboard, clearContents] };
let success: bool = unsafe { msg_send![self.pasteboard, writeObjects:string_array] };
Expand Down

0 comments on commit f569f77

Please sign in to comment.