« first day (1868 days earlier)      last day (1603 days later) » 

12:00 AM
It's in, go wild.
Oops, I totally forgot to finish the title. *edits*
 
 
7 hours later…
7:02 AM
@E_net4saysReinstate I don't get your question. Why has your foo such a weird where clause. Shouldn't it be something like fn foo<F: FnOnce(T), T>(f: F, x: T)
Because x isn't really dropped after the call :/
 
 
1 hour later…
8:08 AM
@hellow It's a pretty theoretical question, but I mean: it's reasonable to want to accept a "callable" that takes a reference as argument right? And if you want to pass a reference to a local variable of that function, you have to use HRTBs.
 
@E_net4saysReinstate What do you think about the answer to your question so far?
 
8:25 AM
Gief moar pl0x
 
How can you leverage Option methods to better write the thingie line here ? play.rust-lang.org/…
 
@E_net4saysReinstate :D More information? Yeah, want that too
@DenysSéguret One of these?
let thingie = thing.as_ref().map(|s| &**s).unwrap_or("");
let thingie = thing.as_ref().map(AsRef::as_ref).unwrap_or("");
But yeah, I struggled with this exact thing already plenty of times
Or simply: thing.unwrap_or("".into()). Empty strings do not allocated, right?
 
I didn't know about the empty string optimization. But the general case is still interesting and painful...
 
OH BOY! Look what I jut found: Option::as_deref.
 
not stable
I stumbled on this one a few times only to see that I can't use it
 
8:37 AM
It will be stable in 1.40. I.e. next release. Woop woop
Here, you can use it on beta already: play.rust-lang.org/…
let thingie = thing.as_deref().unwrap_or("");
Noice
 
Sometimes you have a struct full of references to some local data. And you'd like to return that struct. There should be a way to kindof wrap the data with the struct without changing the struct, for example telling something like "leak this until the struct is dropped".
 
 
2 hours later…
10:47 AM
Dont get how downvoting this helps anyone to be honest — simao 16 hours ago
Why isn't std::mem::drop exactly the same as the closure |_|() in higher-ranked trait bounds?
I knew who is asking.....
 
11:52 AM
This guy asks a lot of questions : stackoverflow.com/users/9259778/nurbol-alpysbayev
 
12:02 PM
Counted, 16 for 17 days of rust
 
12:21 PM
that ok for me
that not very good question
but not so bad
 
 
1 hour later…
1:25 PM
Hi guys! How is it going?
I'm stucked again with owner moving concepts and std::sync_channels
I'm creating a channel, and I want to give the receiver side to a struct that I create withing a closure. I'm not using the receiver side anywhere elso, but I'm getting that
`cannot move out of 'writer_receiver', a captured variable in an 'FnMut' closure`
and it's driving me crazy for days!
 
@Flashito Where is the code?
 
1:43 PM
@Flashito you (probably) need to clone it
 
Let me put the snippets here
I'm having this:
```
let (market_reader_sender, market_reader_receiver) = mpsc::sync_channel(MAX_MESSAGE_QUEUE);
match connect(address, move |out| {
let market = thread2::Market::new(market_reader_receiver);

// Spinning threads
// Market thread
thread::spawn(move || {
market.run();
});

// [...]
})
```
(Trying to format this code here)
 
Try to use play.rust-lang.org instead
 
Good idea
 
Note that many of the mpsc problems are solved by just using crossbeam instead
 
I think this one could be one of those times... but although I'll check them
I'm now willing to understand my problem... I think I'm missing some rust there...
It's something like this:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=184161b04f30aa0cd7f1ad08f036220c
The structs that you can see there, the contain senders and receivers for the channesl
 
2:19 PM
@Flashito ctrl + k
@Flashito that not a mcve
you cant clone Sender in std, you can share it with Arc<Mutex<Sender>>
 
@Flashito You can format only the whole message.
 
@Stargateur I'm not getting serros in the sender clonning
@FrenchBoiethios Thanks for the formatting tip :)
The error that I'm getting is:
28 | let market = thread2::Market::new(market_reader_receiver, market_writer_sender.clone());
| ^^^^^^^^^^^^^^^^^^^^^^ move occurs because `market_reader_receiver` has type `std::sync::mpsc::Receiver<messages::Messages>`, which does not implement the `Copy` trait
 
@Shepmaster is the playground down atm?
 
Yeah, I got 504 from here too.
 
2:37 PM
yeah, me too
 
2:49 PM
Thanks
Checking
Remember the backup at play.integer32.com
 
Bookmarking it :)
thanks
 
the standard playground usually works very fine for me (thanks for it @Shepmaster)
 
I think I've understood what's my problem.
I'm creating a fnMut closure that captures a channel::receiver which can't be copied. Now the question is... how could I avoid that apart from defining the channel inside the closure?
 
3:04 PM
@Shepmaster I see it's back online now -- what was it?
 
No idea, sadly
The playground process was not responding to HTTP requests
 
The playground uses Iron as the web framework
Which isn't super actively maintained
I've an issue to switch to something more modern
 
Let me know if we could help
> fair point. in that case Gotham is better choice I guess.
In case of what? Self advertising?
 
Was the self advertising that incessant? :s
 
3:19 PM
If somebody had told me 20 years ago, when I was building web apps, that I would be making terminal applications in 2020, I would not have thought that possible. What went so wrong ?
 
Help-wise, I just edited the primary comment
 
@DenysSéguret I wouldn't say things went wrong -- on the contrary actually..
@Shepmaster I saw it. I'm not promising I will look into it (mostly because I don't have that much experience in server-side Rust.. I have a lot in other languages but not with Rust)
 
@PeterVaro No pressure. It's been running Iron for years with little issue
 
but maybe later on, I'll start my holiday in less than two weeks, and discovering the server-side solutions is definitely on the my list
 
It's probably more likely that moving to something new will find new bugs
 
3:25 PM
I can almost certainly guarantee that :)
(that's how software works, eh?)
 
For example, crates.io uses a weird-ass custom server thing and they tried to basically do a cargo update for all the crates and got segfaults (IIRC)
 
I was actually going to ask you why do we not use a "weird-arse custom server thing" for the playground in the first place?
 
@PeterVaro If updating a weird-ass custom server thing leads to segfaults, I'd want to stay away from that.
 
@PeterVaro Cause then the playground (aka 98% me) would be responsible for maintaining that.
Also, I linked to conduit, which is also used with civet
which is a wrapper around a C library
so it depends on what level of "custom" you mean
 
@E_net4saysReinstate it doesn't necessarily mean it has to..
but yeah, I understand the bottleneck here -- if it is mainly maintained by you as a side-side-side-project
 
3:32 PM
The "don't touch, it works" principle can only go so far.
 
it doesn't make sense writing a custom stuff for this -- even if the requirement of this server is a very specific, well defined and limited functionality one, which may not require a full-blown framework
 
4:11 PM
In this example (2) or (3) don't seem to work. Did you manage to get it to work on the playground? — Delta_Fore 1 min ago
O_O
After I berated the OP about not providing a working example
Let's see how self aware they are...
 
5:10 PM
@MatthieuM. you tried, now it's up to the OP to see the light
 
Did someone already use docs.rs/sass-rs?
 
5:21 PM
@Shepmaster shrug
 
5:48 PM
@FrenchBoiethios Not I. I'd honestly use the JS ecosystem for all that kind of stuff.
Recently, I've liked using CSS modules and cssnext.github.io
instead of SASS
well, I moved to preset-env.cssdb.org, but I still call it the old name, I guess
 
6:34 PM
@Shepmaster that not the only one ? :p
@Shepmaster "if our architecture separation pays off or not..." guess... no ? ^^
@DenysSéguret good you mean
 
@Stargateur I've only attempted to move from Iron to Tower-Web. The separation of the web code from the playground code was mostly clean, but I did add some more abstraction. Ideally there's an environment variable that allows running either Iron or $NEWFRAMEWORK in the same binary
the problem I had then was that most of the things I wanted weren't present in the framework (like side-by-side precompressed files)
 
@Stargateur Seriously... 20 years ago I was building template engines to render pretty things as HTML in shiny browsers... and I finished yesterday a stupid template engine to render chars as markdown in a terrminal...
 
7:07 PM
@DenysSéguret you join the good side of the force
 
So this recent question shows some misunderstandings of how things work. I think most of us here in the channel know these things, but I can't honestly remember how I came to learn them. Do y'all remember?
 
 
1 hour later…
8:37 PM
@Shepmaster that println doesn't take ownership ?
 
@Stargateur About blocking work and processes
 
> In this contrived example, one could join on the returned thread handles from the spawned threads, but what if join is not available and the child threads are blocking? Do you just resign yourself to forfeiting the cleanup code after the part of the code that may be blocking?
I don't even understand what that mean
 
They have code like block_on_io_maybe_forever(); do_some_cleanup() and they want to know how to ensure that do_some_cleanup will be called
 
9:02 PM
@Shepmaster That impossible
 
@Stargateur yes. My point is: how do we know that?
 
so my answer is no I never threw it was possible :p
My first language is C so...
 
9:19 PM
Sara Chipps and Juan Garza on November 25, 2019

TLDR; We’re going to be sharing our product development process with you, from feedback loops to timelines. We’ll be doing so through our new series – The Loop. You can give us your thoughts on what you’d like to see us do by filling out this survey: Through the Loop. We’ll also be releasing Moderator Training and some new feedback mechanisms to help us form decisions as we grow. 

Since the early days of Stack Overflow, our community has seen a lot of growth and change. As we reflect on 2019 and start thinking about 2020, our company also continues to rapidly grow. We have new l …

 
9:31 PM
> create an experience that works for all users
oh faery tail and magic
> show everyone how we think about serving the larger developer and technical community
"show" xd
> We’ll share regular updates about what we learn through our research
hope we will get NOTIFICATION
 
 
2 hours later…
11:45 PM
uhh w-why are there 128-bit wide pointers?
I thought C++'s pointer-to-members which aren't actually pointers were bad, but this..
maybe I'm being dumb, but how do I pass a &mut dyn Write as a userdata pointer?
I have out: &'out mut dyn Write and out as *mut dyn Write as *mut c_void on the caller side, coupled with client_data: *mut c_void and &mut *transmute::<_, *mut dyn Write>(client_data) in the callback, but..
 

« first day (1868 days earlier)      last day (1603 days later) »