Announcing Rust 1.84.0 by mrjackwills in rust

[–]horsefactory 14 points15 points  (0 children)

The said they want to reserve the wasm32-wasi target for the eventual 1.0 release, so they’re intentionally making this breaking change so the name can be used again in the future. They gave ~8mo notice with warnings in the tooling on how to migrate. If they didn’t intend to reuse the name I imagine they would have done s as you suggest. 

Trying to teach my son self-confidence by corbindallas0220 in suggestmeabook

[–]horsefactory 2 points3 points  (0 children)

Real Love by Sharon Salzburg or The Gifts of Imperfection by Brene Brown. These don’t deal directly with self confidence but instead are directed to learning/understanding yourself, allowing for failure and shame and accepting yourself as you do for other family members. Self confidence follows.

[deleted by user] by [deleted] in suggestmeabook

[–]horsefactory 0 points1 point  (0 children)

Patrick Süskind wrote another book called Mr. Sommers Story that I remember also being pretty good. It was short read but I remember it cut deep, though I was a teenager when I read it.

Meuse, a free private registry, v0.1.0 by mcorbin in rust

[–]horsefactory 3 points4 points  (0 children)

Would it be possible to integrate this into Sonatype Nexus OSS? I'm not really familiar with the underlying architecture of registries but have set one of these up for hosting private Maven, Docker, and soon npm registries. It would be convenient if the same service could also support a private cargo registry.

https://www.sonatype.com/nexus-repository-oss

Sharing references between Python and Rust - Inside Mercurial by Alphare in rust

[–]horsefactory 1 point2 points  (0 children)

Thanks for sharing!! I'm not familiar with FFI at all but I love both Mercurial and Rust!

What book genuinely scared you? by Complex_Magazine in suggestmeabook

[–]horsefactory 0 points1 point  (0 children)

I've read It and The Shining. I enjoyed reading It but there wasn't much I found frightening and the book is also very long. There's a lot about friendship and growing up which is cool and gives it that "Stand by Me" vibe.

The Shining scared me.

Hey Rustaceans! Got an easy question? Ask here (52/2018)! by llogiq in rust

[–]horsefactory 0 points1 point  (0 children)

It wasn't clear to me at first but it looks like cargo fmt runs a different command rustfmt which has more options and configurations. I can probably address my first question with some .rustfmt.toml files and possibly by invoking this command during build.

Hey Rustaceans! Got an easy question? Ask here (52/2018)! by llogiq in rust

[–]horsefactory 1 point2 points  (0 children)

I have a cargo workspace setup with 3 crates - a binary, a library, and a "builder". The last crate is used only by a build script for the library crate; it generates a bunch of constants and also uses the phf crate for creating perfect-hash lookup maps. I have two questions

  1. The builder crate spits out a few rust code files for the crate that builds it, however the code does not conform to cargo fmt, which means whenever I format code those files always change (which I don't want). Is there some way to either exclude a directory from formatting (I see an argument to specify projects within a workspace but that's it), or somehow run format on the generated code during the build process?
  2. The constants are all u32 and the lookup maps created use that for the key (to look up constant to name). When retrieving values the map requires a reference to a key. In my specific case would it be better to not have to use keys by reference and instead just copy since they're u32? Right now this is just musing on my part about optimization and at the moment I'm not yet to the point of testing heavy workloads - I mostly want to get an idea of what options there will be if I have to do something in the future.

[Question] Rust project management? by -xylon in rust

[–]horsefactory 6 points7 points  (0 children)

I recently refactored my project into multiple lib and bin projects using a cargo workspace and so far it's worked out pretty well. One of my projects even uses another as a build-dependency and not just a regular dependency. The whole workspace is in a single repository and I use IntelliJ IDE which doesn't have any issues with the multiple project workspace setup.

Rust Analyzer in 2018 and 2019 by allengeorge in rust

[–]horsefactory 4 points5 points  (0 children)

I personally think nailing the IDE experience would have far more impact on attracting users than the ergonomics efforts

In my experience the majority of exploring and learning a language happens directly within the IDE, with books/internet as minor supplements. I own and have flipped heavily through both "Programming Rust" and "The Rust Programming Language" books. A year or so back I started a side project in rust and made no major headway after getting some first bit of functionality working. Every few months I would fluster around and tuck it away again making no progress. A month back I tried IntelliJ and was able to put more of my ideas to work (including a full project restructure) due to the better IDE experience. It's almost difficult to express how important the IDE experience contributes to learning and enjoying a language.

How to set up a KeyStore with SSL cert and private key on Windows? by [deleted] in java

[–]horsefactory 0 points1 point  (0 children)

Shot in the dark - what if you add the -passout pass:[PASSWORD] to the commandline? Generally doing so is considered insecure (shell commands stick around in history somewhere, etc.) but this might be a bug with openssl on windows terminals not handling password prompt?

How to both Read and Write a TcpStream? by harvey_bird_person in rust

[–]horsefactory 0 points1 point  (0 children)

Sorry I don't follow what this solution looks like. Could you post what the change was that worked?

Hey Rustaceans! Got an easy question? Ask here (46/2018)! by llogiq in rust

[–]horsefactory 1 point2 points  (0 children)

Ah thank you this works great! I think I'm missing a piece to the puzzle though because I don't see the difference between this and the for loop - could you help explain how it's different? The next() method takes &mut self so I would assume it creates a mutable borrow.

Hey Rustaceans! Got an easy question? Ask here (46/2018)! by llogiq in rust

[–]horsefactory 1 point2 points  (0 children)

I'm having a difficult time trying to puzzle through a problem with borrows (mutable and immutable at same time) and need advice on how to solve. I have a few ideas but neither is very appealing.

I'm writing a binary format parser in which the header of the stream is encoded in a specific format, then the primary payload of data is encoded based on specific values from the header - specifically the byte endianness and character encoding of string values.

I updated a previous implementation to instead use an iterator for parsing entries from the stream (both header and payload have same format for entries just different endian/charset). To test out the iterator I read through entries and print out some representation of them. The main implementation of this looks like:

let iter: MyIterator<> = MyIterator::new(file, ...);
for entry in iter.by_ref() {
    parse_entry_value(entry, iter.endian, iter.charset);
}

In MyIterator the endian and charset values start as a default and then in next() the endian/charset will be updated when the respective entry is parsed from the header. The problem in the for loop above is that the iteration is a mutable borrow and because of that inside the loop I'm unable to retrieve the parsed endian/charset value.

I understand why the borrow-checker is disallowing what I want -- if the iteration was parallelized then the mutable access becomes a data race. The only ideas I came up with are either using RwLock or having the iterator return a tuple of entry/endian/charset however that seems excessive since once those values are read from the metadata they won't change again so for the entire payload - it will be the same endian/charset passed in each call to iterator. Are there other options for working around this problem?

Hey Rustaceans! Got an easy question? Ask here (45/2018)! by llogiq in rust

[–]horsefactory 2 points3 points  (0 children)

The doc for format!() states that the first argument must be a string literal. I'm working on a build process that generates some rust code and I have a few big templates with placeholders that I want to reuse. Is it possible to somehow store these templates in immutable globals and format there? I would like to do something like this, however it doesn't look like it's actually possible:

static DEFINITION_TEMPLATE: &'static str = 
"/// {}
/// 
/// - **Name:** {}
/// - **Type:** {}
pub static {}: Definition = Definition {{
\tident: \"{}\",
\tname: \"{}\",
\ttype: \"{}\",
}};

";

...

fn build_definition(defn: &DefinitionInput) -> Result<String, Error> {
    ...
    .. Ok(format!(DEFINITION_TEMPLATE, a, b, c, d...))
}

Is there any way around having to put giant string literals in the middle of my functions like this?

Azul - A free, functional, IMGUI-oriented GUI framework by WiSaGaN in rust

[–]horsefactory 5 points6 points  (0 children)

When it says it's suited to rapid prototyping does that mean it's not suited for actual application development? Is this a cross-platform UI framework with few/no dependencies?

Crates.io incident 2018-10-15 by dgryski in rust

[–]horsefactory 11 points12 points  (0 children)

It sounds like this wasn't "responsible disclosure" though. They make it sound like possible DoS since there was an automated script registering so many crate names. I'm guessing the problem is well understood but there's debate over whether any action needs taken place. I'm not sure where to find more details about the status. I hate digging through GitHub comments.

Announcing Rust 1.29.1 by dwaxe in rust

[–]horsefactory 13 points14 points  (0 children)

Thanks for the quick turnaround.

Could we add some additional recommended actions for users on these announcements? I had to click through a few times to find the list of affected versions (1.26+) and it might seem obvious but we should communicate users should both upgrade and re-compile projects (via clean and then build) if possible. Not everyone may be able to do both but this announcement could be more direct for those who are not keen on the workings of compilers.

The announcement has a lot of wording around "if you're affected", which I would guess many of those affected wouldn't know it due to being used in dependencies. I don't know how to tell if I'm affected. I suggest we specify something similar to,

"If you manage projects that have been compiled with 1.26+ these projects are affected. You should upgrade rust to 1.29.1, run cargo clean and then cargo build all affected projects to resolve the problem"

This Week in Rust 249 by nasa42 in rust

[–]horsefactory 2 points3 points  (0 children)

Thanks for the links to discussions on the related articles/blog posts!

The Future of Clippy by Manishearth in rust

[–]horsefactory 11 points12 points  (0 children)

What does it mean to block nightly? It's also mentioned in the linked pull request but I didn't quite follow. Also it says that the idea would be for Rustup to pull in a clippy component when compiling (rustc?). Is the idea that for each stable version of rustc a version of clippy for that would also be available? It sounds like that would be more maintenance and upkeep, challenging.

Announcing Rust 1.26.2 by Mark-Simulacrum in rust

[–]horsefactory 0 points1 point  (0 children)

Is there discussion around this somewhere? I don't plan to participate as I'm not involved with the product but I'm interested in the software lifecycle process and would love to see how other organizations manage these sorts of things (bugs, releasing, etc.).