Sign in

iiinova is part of the Atmosphere — an open, public network where you own your identity.

Danik Vitek

@danikvitek.eurosky.social
36 followers 98 following 150 posts

Passionate about software development Computer science/IT student at National Technical University of Ukraine "Kyiv Polytechnic Institute" 🇺🇦 (GMT+2) codeberg.org/DanikVitek tangled.org/danikvitek.eurosky.social github.com/DanikVitek

PostsRepliesMedia
Danik Vitek @danikvitek.eurosky.social · 09/08/2026
Грали учора ввечері у Dorf Romantic
010 1
Danik Vitek @danikvitek.eurosky.social · 09/08/2026
020 2
Danik Vitek @danikvitek.eurosky.social · 05/07/2026
First time seeing this kind of shadow crown effect around the clouds
110 1
Danik Vitek @danikvitek.eurosky.social · 06/05/2026
Just implemented a basic sine wave synthesizer :)
030 3
Danik Vitek @danikvitek.eurosky.social · 05/05/2026
Building a synth from scratch in Zig. Implemented reading of a MIDI device
130 3
Danik Vitek @danikvitek.eurosky.social · 24/04/2026
Rust compiler error, saying that there is no war in Ba Sing Se
110 1
Danik Vitek @danikvitek.eurosky.social · 25/10/2025
I ♥️ #JavaScript
Application's "Account" screen, with an error pop-up, that appeared after clicking the "Connect to the bus WiFi" button. The error reads: "Cannot read property 'connectToNetwork' of undefined..."
110 1
Danik Vitek @danikvitek.eurosky.social · 04/09/2025
#Silksong is finally at my doorstep! Good luck to everybody else!
020 2
Danik Vitek @danikvitek.eurosky.social · 04/09/2025
It's happening! xD #silksong
000 0
Danik Vitek @danikvitek.eurosky.social · 04/09/2025
Hollow Knight: Silksong
000 0
Danik Vitek @danikvitek.eurosky.social · 12/08/2025
For instance: Line 573: create an iterator over the string's codepoints; Line 574: try get the next value in the iterator or exit; Line 578: Iterate over the rest of the iterator with a plain loop (`for` loops are kind-of a syntactic sugar for `while-next` loops)
#[derive(Clone, Copy)]
enum KeyDisplayState<'a> {
    NonProcessed(&'a Key),
    Ident(&'a str),
    String(&'a str),
    Bytes(&'a [u8]),
}

impl KeyDisplay<'_> {
    fn process(&self) {
        if let KeyDisplayState::NonProcessed(key) = self.0.get() {
            if key.is_empty() {
                self.0.set(KeyDisplayState::String(""));
                return;
            }
            match core::str::from_utf8(key.as_ref()) {
                Ok(s) => {
                    let mut chars = s.chars();
                    let Some(first) = chars.next() else {
                        return self.0.set(KeyDisplayState::String(s));
                    };
                    let is_ident = unic_ucd_ident::is_xid_start(first);
                    for c in chars {
                        if !unic_ucd_ident::is_xid_continue(c) {
                            self.0.set(KeyDisplayState::String(s));
                            return;
                        }
                    }
                    if is_ident {
                        self.0.set(KeyDisplayState::Ident(s));
                    } else {
                        self.0.set(KeyDisplayState::String(s));
                    }
                }
                Err(_) => {
                    self.0.set(KeyDisplayState::Bytes(key.as_ref()));
                }
            }
        }
    }
}
110 1
Danik Vitek @danikvitek.eurosky.social · 22/03/2025
magnifying glass, projecting an image of the window onto the wall. The image is flipped
000 0
Danik Vitek @danikvitek.eurosky.social · 11/02/2025
Does anybody know what could be done about this? #rustlang
impl<const C: char, Tail: Symbol> Symbol for Cons<C, Tail> {
    // can't use generic parameters from outer item [E0401]
    // use of generic parameter from outer item
    // Note: a `const` is a separate item from the item that contains it
    const VALUE: &'static str = concatcp!(C, <Tail as Symbol>::VALUE);
    
    type Chars = Chars<C, <Tail as Symbol>::Chars>;

    fn new() -> Self {
        Self(Tail::new())
    }

    fn chars() -> Self::Chars {
        Chars {
            used_c: false,
            tail: Tail::chars(),
        }
    }
}
200 2
Danik Vitek @danikvitek.eurosky.social · 10/02/2025
Usage example
000 0
Danik Vitek @danikvitek.eurosky.social · 09/02/2025
Was working on a master’s degree project and got caught up in the implementation of the `Path` type, that is somewhat analogous to how JS objects are indexed. Here are the tests for the macro and `Display` representations in comments. #rustlang
#[test]
fn test_path_foo() {
    insta_assert!(path!(foo)); // `foo`
}

#[test]
fn test_path_s_foo() {
    insta_assert!(path!(*.foo)); // `foo`
}

#[test]
fn test_path_s_q_foo_q() {
    insta_assert!(path!(*["foo"])); // `foo`
}

#[test]
fn test_path_foo_bar() {
    insta_assert!(path!(foo.bar)); // `foo.bar`
}

#[test]
fn test_path_foo_q_bar_q() {
    insta_assert!(path!(foo["bar"])); // `foo.bar`
}

#[test]
fn test_path_foo_q_bar_sp_baz_q() {
    insta_assert!(path!(foo["bar baz"])); // `foo["bar baz"]`
}

#[test]
fn test_path_foo_0() {
    insta_assert!(path!(foo[0])); // `foo[0]`
}

#[test]
fn test_path_foo_xFF() {
    insta_assert!(path!(foo[b"\xFF"])); // `foo[b"\xFF"]`
}
010 1
Danik Vitek @danikvitek.eurosky.social · 05/02/2025
000 0