Skip to content

Commit

Permalink
Merge pull request #61 from cwahbong/refactor-plugin-buffer
Browse files Browse the repository at this point in the history
Split buffer plugin into modules.
  • Loading branch information
cwahbong committed Jun 12, 2016
2 parents 6cf9341 + 5d975e8 commit aa4cebe
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 347 deletions.
8 changes: 4 additions & 4 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ fn bench_create_and_delete_buffers(b: &mut Bencher) {
let mut active_client = Client::connect_unix(&t.socket_name).unwrap();

b.iter(|| {
let new_response: plugin::buffer::NewResponse = match active_client.call(
"buffer.new", &plugin::buffer::NewRequest {
let new_response: plugin::buffer::new::Response = match active_client.call(
"buffer.new", &plugin::buffer::new::Request {
content: Some("bli\nbla\nblub".into()),
}).unwrap().wait().unwrap()
{
rpc::Result::Ok(value) => serde_json::from_value(value).unwrap(),
err => panic!("{:?}", err),
};

let _: plugin::buffer::DeleteResponse = match active_client.call(
"buffer.delete", &plugin::buffer::DeleteRequest {
let _: plugin::buffer::delete::Response = match active_client.call(
"buffer.delete", &plugin::buffer::delete::Request {
buffer_index: new_response.buffer_index
}).unwrap().wait().unwrap() {
rpc::Result::Ok(value) => serde_json::from_value(value).unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions gtk_gui/src/bin/gtk_gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ impl SwiboeGtkGui {
println!("#sirver keypress: {}", time::precise_time_ns());
match &name_str as &str {
"F2" => {
let mut rpc = thin_client.call("buffer.open", &plugin::buffer::OpenRequest {
let mut rpc = thin_client.call("buffer.open", &plugin::buffer::open::Request {
uri: "file:///Users/sirver/Desktop/Programming/rust/Swiboe/gui/src/bin/gtk_gui.rs".into(),
});
let b: plugin::buffer::OpenResponse = rpc.wait_for().unwrap();
let b: plugin::buffer::open::Response = rpc.wait_for().unwrap();
println!("#sirver b: {:#?}", b);
},
"F3" => {
Expand Down
4 changes: 2 additions & 2 deletions gui/src/buffer_views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ impl BufferViews {
}

pub fn new_view(&mut self, buffer_index: usize, width: usize, height: usize) -> String {
let mut rpc = self.client.call("buffer.get_content", &plugin::buffer::GetContentRequest {
let mut rpc = self.client.call("buffer.get_content", &plugin::buffer::get_content::Request {
buffer_index: buffer_index,
}).unwrap();

let response: plugin::buffer::GetContentResponse = rpc.wait_for().unwrap();
let response: plugin::buffer::get_content::Response = rpc.wait_for().unwrap();
let buffer_view = BufferView::new(width, height, &response.content);
let view_id = buffer_view.id().to_string();
self.buffer_views.insert(buffer_view.id().to_string(), buffer_view);
Expand Down
325 changes: 0 additions & 325 deletions src/plugin/buffer.rs

This file was deleted.

0 comments on commit aa4cebe

Please sign in to comment.