inlinevoid

u/inlinevoid


r/linuxquestions•

Problem

I'd like to increase the rate my mouse wheel scrolls pages, and I'd like to do it system-wide. It's too slow in every application.

I have a Logitech G400s Wired Mouse. My distro is Void Linux.

What I've tried

I've checked xinput for some sort of scroll speed property, but there doesn't appear to be any.

Device 'Logitech G400s Optical Gaming Mouse':
    Device Enabled (144):   1
    Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (279):  
95


r/rust•

I'm tired, but I feel like the compiler is wrong here.

#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate bincode;

fn foo<T>(t: &T) where T: serde::ser::Serialize {
    let encoded: Vec<u8> = bincode::serialize(t, bincode::Infinite).unwrap();
}

On nightly, errors with:

error[E0277]: the trait bound `T: serde::ser::Serialize` is not satisfied
 --> /foo/src/lib.rs:7:28
  |
7 |     let encoded: Vec<u8> = bincode::serialize(t, bincode::Infinite).unwrap();
  |                            ^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `T`
  |
  = help: consider
316



r/rust•

Sometimes I'd like to panic! if a Result is an Err. Calling unwrap() does that but will print ../src/libcore/result.rs:788 as the source of the panic (which makes sense, but isn't useful to me).

EDIT: So basically

match result {
    Ok(result) => result,
    Err(e) => panic!(format!("{:?}", e)),
}

As a macro. I'll write one for my own use if it doesn't exist.

EDIT #2: For anyone passing by, this is what I ended up using:

pub trait TryUnwrap {
    type Value;
    type Error;
    fn try_unwrap(self) -> Result<Self::Value, Self::Error>;
}

impl<T> TryUnwrap for Option<T> {
    type Value = T;
1115


r/rust•

I'm mainly a C++/C# programmer and I'm so used to:

  • being able to look at memory on break/crash
  • toggle breakpoints with one click
  • get stacktraces on crash

I program in Rust on Windows using Sublime Text and I've been getting by with just using #[derive(Debug)] and println!.

Is there anything that can offer me what I'm used to with Visual Studio?

1830


r/rust•

I'm writing a really simple program that's essentially:

fn main() {
	while(true) {
		let data = read_file("foo.txt");
		process_data(&data);
		std::thread::sleep_ms(5000);
	}
}

I'm really new to Rust, but it's my understanding that if my program compiles and I'm not using unsafe code, there shouldn't really be a memory leak. Yet, my program starts off at 0.6mb~ and steadily grows.

There are a few other posts on r/rust experiencing the same thing but no concrete answers as to why that happens. So here's another thread asking: anyone know the cause?

EDIT Here's the full code: https://gist.github.com/anonymous/4c6d5ebbd7d9879e64e7

It's super messy a

66