This file contains hidden or 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
// Really bad psuedo rust | |
struct Foo { | |
... | |
} | |
#[no_mangle] | |
thing_init() -> *mut Foo { | |
Box::into_raw( Foo {} ) | |
} |
This file contains hidden or 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
#[derive(Debug)] | |
struct ADTest { | |
rp_id_hash: Vec<u8>, | |
exten_pres: u8, | |
acd_pres: u8, | |
user_present: u8, | |
user_verified: u8, | |
} | |
named!( authenticator_data_flags<&[u8], (u8, u8, u8, u8)>, |
This file contains hidden or 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
Authentication Use Cases | |
------------------------ | |
There are many planned integrations for authentication for a service like this. The uses cases | |
for what kind of auth are below: | |
Kanidm account system | |
===================== |
This file contains hidden or 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
#[macro_use] | |
extern crate serde_derive; | |
extern crate actix; | |
extern crate actix_web; | |
use actix::prelude::*; | |
use actix_web::{ | |
fs, http, middleware, server, App, FutureResponse, HttpRequest, HttpResponse, Path, State, Json, | |
}; |
This file contains hidden or 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
fn put_db_json(dbname: &str) -> impl Future<Item=Response<Body>, Error=hyper::Error> { | |
let client = Client::new(); | |
let uri: hyper::Uri = format!("http://127.0.0.1:5984/{}", dbname).parse().unwrap(); | |
let req = Request::post(uri).body(Body::empty()).unwrap(); | |
client | |
.request(req) | |
.and_then(|res| { |
This file contains hidden or 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
tokio::spawn( | |
lmaddr.send(LightManagerStatus) | |
.map_err(|_| ()) | |
.then(|r| { | |
println!("status outer: {:?}", r); | |
actix::System::current().stop(); | |
// future::result(Ok(())) | |
actix::fut::ok(()) | |
}) | |
); |
This file contains hidden or 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
// Does not work | |
System::run(|| { | |
let fut = lmaddr.send(LightManagerRegister(tbulb_1)) | |
.map_err(|_| ()) | |
.and_then(move |_res| { | |
lmaddr.send(LightManagerStatus) | |
.map_err(|_| ()) | |
.map(|r| { | |
println!("status: {:?}", r); |
This file contains hidden or 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
extern crate actix; | |
extern crate futures; | |
extern crate tokio; | |
use actix::prelude::*; | |
use futures::Future; | |
struct Status; | |
impl Message for Status { |
This file contains hidden or 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
extern crate actix; | |
extern crate futures; | |
extern crate tokio; | |
use actix::prelude::*; | |
use futures::Future; | |
struct Toggle; | |
impl Message for Toggle { |
This file contains hidden or 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
let fut = lmaddr.send(LightManagerRegister(tbulb_1)) | |
.and_then(|_res| { | |
lmaddr.send(LightManagerStatus).then(|r| { | |
println!("{:?}", r); | |
Ok(()) | |
}); | |
Ok(()) | |
}); |
NewerOlder