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::time::Duration; | |
use futures::{SinkExt, StreamExt}; | |
use iced::{Element, Length, Subscription, Task}; | |
use iced::widget::{Column, text_input, Text}; | |
/// An example showing how a channel can generate values which can then be | |
/// mapped into Messages that get sent to your application. | |
/// In this example, the sender sends integers and the GUI only displays even values. | |
pub fn channel_to_messages() -> iced::Result { | |
iced::application("test", MyApp::update, MyApp::view) |
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
// Cargo.toml | |
// iced = { git = "https://github.com/iced-rs/iced.git", features = [ "canvas", "tokio" ] } | |
// futures = "0.3.30" | |
// tokio-stream = "0.1.15" | |
// crossbeam = "0.8.4" | |
// crossbeam-channel = "0.5.13" | |
use std::thread; | |
use std::time::Duration; | |
use crossbeam_channel::{Receiver, unbounded}; |
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
// Cargo.toml | |
// iced = { git = "https://github.com/iced-rs/iced.git", features = [ "canvas", "tokio" ] } | |
// futures = "0.3.30" | |
// tokio-stream = "0.1.15" | |
// crossbeam = "0.8.4" | |
// crossbeam-channel = "0.5.13" | |
use std::thread; | |
use std::time::Duration; | |
use crossbeam_channel::{Receiver, unbounded}; |
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
struct Opcode { | |
opcode: u8, | |
name: &'static str, | |
size: usize, | |
} | |
let mut result: HashMap<u8, Opcode> = HashMap::new(); | |
for op in ops { | |
result.insert(op.0, Opcode::new(op.0, op.1, op.2)); | |
} |
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
pub const BRK: u8 = 0x00; | |
pub const JSR: u8 = 0x20; | |
// ... | |
// opcode hex, opcode name, instruction size | |
let ops: Vec<(u8, &str, usize)> = vec![ | |
(BRK, "BRK", 1), | |
(JSR, "JSR", 3), | |
// ... | |
]; |
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
enum class Opcode(val opcode: Int, val opName: String, val size: Int) { | |
BRK(0x00, "BRK", 1), | |
JSR(0x20, "JSR", 3) | |
// … | |
} |
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
// skip 'visible', use its default value | |
val w = Window(0, 0, blackAndWhite = true) | |
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
val w = Window(0, 0, visible = false, blackAndWhite = true) | |
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
val w = Window(0, 0, false, true) // mmmh, which boolean means what? | |
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
class Window(x: Int, y: Int, visible: Boolean = false, blackAndWhite: Boolean = false) | |
NewerOlder