Skip to content

Instantly share code, notes, and snippets.

@tupshin
Created August 9, 2014 12:41
Show Gist options
  • Save tupshin/f3335554b0db254a650e to your computer and use it in GitHub Desktop.
Save tupshin/f3335554b0db254a650e to your computer and use it in GitHub Desktop.
fn send (&mut self, err: c_int, bytes: &[&[u8]]) {
assert!(self.sender.is_some());
let len = bytes.iter().fold(0, |l, b| { l + b.len()});
let header = fuse_out_header {
len: (mem::size_of::<fuse_out_header>() + len) as u32,
error: -err,
unique: self.unique,
};
as_bytes(&header, |headerbytes| {
let sender = self.sender.take_unwrap();
let header_vec = Vec::from_slice(headerbytes).append(bytes).as_slice();
sender(header_vec);
});
}
src/reply.rs:125:21: 125:36 error: cannot infer an appropriate lifetime due to conflicting requirements
src/reply.rs:125 let header_vec = Vec::from_slice(headerbytes).append(bytes).as_slice();
^~~~~~~~~~~~~~~
src/reply.rs:115:51: 128:3 note: first, the lifetime cannot outlive the anonymous lifetime #3 defined on the block at 115:50...
src/reply.rs:115 fn send (&mut self, err: c_int, bytes: &[&[u8]]) {
src/reply.rs:116 assert!(self.sender.is_some());
src/reply.rs:117 let len = bytes.iter().fold(0, |l, b| { l + b.len()});
src/reply.rs:118 let header = fuse_out_header {
src/reply.rs:119 len: (mem::size_of::<fuse_out_header>() + len) as u32,
src/reply.rs:120 error: -err,
...
src/reply.rs:125:57: 125:62 note: ...so that expression is assignable (expected `&[&[u8]]` but found `&[&[u8]]`)
src/reply.rs:125 let header_vec = Vec::from_slice(headerbytes).append(bytes).as_slice();
^~~~~
src/reply.rs:123:35: 127:4 note: but, the lifetime must be valid for an anonymous lifetime defined on the block at 123:34...
src/reply.rs:123 as_bytes(&header, |headerbytes| {
src/reply.rs:124 let sender = self.sender.take_unwrap();
src/reply.rs:125 let header_vec = Vec::from_slice(headerbytes).append(bytes).as_slice();
src/reply.rs:126 //sender(header_vec);
src/reply.rs:127 });
src/reply.rs:125:21: 125:36 note: ...so that type matches impl (expected `&[u8]` but found `&[u8]`)
src/reply.rs:125 let header_vec = Vec::from_slice(headerbytes).append(bytes).as_slice();
^~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment