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
| /* | |
| Representing JSON in Rust objects | |
| All objects will always have an ID and Type, but all other fields vary | |
| [ | |
| { | |
| id: 12345, | |
| type: "photo", | |
| photo_url: "asdasda.com" | |
| }, |
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
| "user": { | |
| "name": "doomy", | |
| "likes": 46310, | |
| "following": 242, | |
| "default_post_format": "html", | |
| "blogs": [ | |
| { | |
| "admin": true, | |
| "ask": true, | |
| "ask_anon": true, |
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
| { | |
| "meta": { | |
| "status": 200, | |
| "msg": "OK" | |
| }, | |
| "response": { | |
| "user": { // <== only care about this object | |
| "name": "name", | |
| "likes": 46310, | |
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
| use reqwest; | |
| pub const AUTH_PATH : &str = "https://login.microsoftonline.com/1318d57f-757b-45b3-b1b0-9b3c3842774f/oauth2/authorize"; | |
| pub const TOKEN_PATH : &str = "https://login.microsoftonline.com/1318d57f-757b-45b3-b1b0-9b3c3842774f/oauth2/token"; | |
| pub const AUTH_RESOURCE_PATH : &str = "https://wegmans-es.azure-api.net"; | |
| // Get a bearer token | |
| pub fn authorize(client_id: &str, client_secret: &str, redirect_uri: &str) { | |
| // build our request |
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
| warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir `/vagrant/target/debug/incremental/resamplr-uuwdn7ep95ho/s-ez1onym2h6-14feiei-working` | |
| warning: unused `#[macro_use]` import | |
| --> src/main.rs:19:1 | |
| | | |
| 19 | #[macro_use] | |
| | ^^^^^^^^^^^^ | |
| | | |
| = note: #[warn(unused_imports)] on by default |
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
| #include <ESP8266WiFi.h> | |
| #include <WiFiClient.h> | |
| // How many clients should be able to telnet to this ESP8266 | |
| #define MAX_SERVER_CLIENTS 2 | |
| // Baud rate for serial monitors (useful for development) | |
| #define BAUD_RATE 115200 | |
| // Network name and password for the ESP to connect |
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
| channel Lead { | |
| plugin { | |
| file Piano.vst | |
| name 'baby_grand' | |
| modify { | |
| gain -6db | |
| detune 2% | |
| } | |
| } | |
| } |
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
| Compiling rumblr v0.1.0 (file:///C:/Users/doomy/Documents/code/rumblr) | |
| error[E0277]: the trait bound `error::Error: data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` is not satisfied | |
| --> src\request.rs:65:9 | |
| | | |
| 65 | serde_json::from_str(&buf)? | |
| | ^^^^^^^^^^^^^^^^^^^^ the trait `data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` is not implemented for `error::Error` | |
| | | |
| = note: required because of the requirements on the impl of `data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` for `std::result::Result<data::root::Root, error::Error>` | |
| = note: required by `serde_json::from_str` |
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
| /// Send a given request and deserialize the response | |
| pub fn send_and_deserialize(&self, header: OAuthAuthorizationHeader) -> Result<Root, Error> { | |
| let req = self.clone(); | |
| // Send the request | |
| let mut response = req | |
| .client | |
| .hyper | |
| .request(req.method, &req.url) | |
| .header(Authorization(header.to_string())) |
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 get<T>() -> Result<T, Error> { | |
| serde_json::from_str(..) | |
| } |