Cyclip

u/Cyclip




r/rust•

I'm only able to get the code including the function declaration but I just want to separate the code inside the function. My (relevant) code so far is

pub fn test_macro(_metadata: TokenStream, item: TokenStream) -> TokenStream {
    let input_fn: Item = syn::parse(item).expect("failed to parse input");
}

But input_fn as a string is just fn test() { println!("test"); }, whereas I want just println!("test");. My overall goal is just to modify the function's inner code but I have no idea how to process input_fn.

21

r/rust•

I'm trying to make a simple function with 2 statements both of which mutate 2 variables to link them together

impl<'a> Node<'a> {
    // Add a child to this node
    pub fn add_child(&'a mut self, child: &'a mut Node<'a>) {
        self.children.push(child); // Add child to Vec<&'a Node<'a>>
        child.parent = Some(self); // Set child's parent to Option<&'a Node<'a>>
    }
}

What I understand is that a reference to child is pushed onto self.children at line 4, and there can be any number of references because it is an immutable reference.

Then child is mutably borrowed at line 5 and its `parent

128

r/copypasta•

Winnie the Pooh stares at the empty honey bottles around him. He hides it from everyone, but he hates himself. He can't control himself. He eats so much it's obscene, and nobody seems to want to help him. If anything, people sometimes enable him.

He doesn't have true friends, he realises. They wouldn't let him get to this point, lying on the floor, stuffed to bursting, and covered in the sticky fools gold. This is their fault.

An epiphany befalls onto him -- for each honey bottle entirely devoured, awaits a deep sticky void seducing him -- a cum jar of sorts. With no hesitation his legs stumble across the other, his hands gripping onto the goo filled lid; it and his big dick rises.

The br

12

r/teenagers•

I'm trying to gain weight and it's kind of hard, BUT IM NOT ANOREXIC. People can be a healthy weight (or overweight) and still be anorexic. Just because a person is skinny does not mean they're anorexic. Yes I'm a twig and you should adopt my diet you flab encapsulated cunt you dont deserve to keep your skin on you you're the reason mute people should exist ignorant idiots cant wait to see your casket get carried by a crane aaaaaaaaaa

that was not directed at any of you guys sorry lel

103

r/Discord_Bots•

I have both the url to the video, and a temporary url straight to the audio file. I have ffmpeg and I'm trying to play the audio to a vc, except it doesn't play at all without errors.

​

        voice = self.getVoice(ctx)  # Works successfully
        source = discord.PCMVolumeTransformer(
            discord.FFmpegPCMAudio(url),  # url = "https://www.youtube.com/?watch=v.."
        )

        embed = discord.Embed(
            title=f"Playing {playing[0]}",
            description=f"Song {data['playing'] + 1}/{len(data['queue'])}",
            color=config.uniColour,
        )

        embed.set_thumbnail(url=thumbnailUrl)
    
13

r/teenagers•

i mean thats kind of generalising an entire gender in a negative way and idk. if they said "men are trash" then ye sexist, but "most" makes it seem like it's from experience or something i dont know, all ik is that most guys ik aren't exactly trash it's just prejudicial

217