This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::thread::{self, JoinGuard}; | |
use std::option::Option; | |
use std::marker::Send; | |
fn callback(v: usize) -> usize { v * 2 } | |
type CB = Fn(usize) -> usize + Sync + Send; | |
type Callback = Box<CB>; | |
struct S<'a> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(core)] | |
#![feature(std_misc)] | |
use std::thread::{Thread, JoinGuard}; | |
fn callback(v: usize) -> usize { v * 2 } | |
struct S { | |
cb: Box<Fn(usize) -> usize + Send>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates an object where each property is composed from | |
* an element of keys (key) and the value from callback(key). | |
* | |
* @param {array} keys The array of keys. | |
* @param {function} [callback=_.identity] The callback(key) that returns the object:s values. | |
* @return {object} Returns an object composed of the given keys and callback(key) for values. | |
*/ | |
_.objectMap = function(keys, callback) { | |
callback = callback || _.identity; |
NewerOlder