• 3 Posts
  • 38 Comments
Joined 7 months ago
cake
Cake day: January 25th, 2026

help-circle

  • Given that it’s an ml community it would be blocked for me, too. That behavior is as I described. If you’ve seen any ml comments on this post that’s what I’m talking about. (by “change anything” I meant “relative to no blocklist”)

    I have considered Piefed due to Lemmy’s origins, although being open source and relatively popular I’m confident its developers will be reasonably held in check (unlike with e.g. Tesseract).



  • To start, I’m not trying to have an argument about this.

    So, I can say that, from what I can see, at least in that situation, piefed.social was blocking comments from a person who I didn’t specifically block as an individual, but was a member of an instance that I had blocked.

    Your description doesn’t specify much about the origins of OP or the post. Was the community an “@lemmy.ml” community? If so I would expect it to be blocked. Was their account an “@lemmy.ml” account? If so I wouldn’t expect that to change anything.

    I see a lot of content from ml users, but no posts to their communities, and I use the default Lemmy UI. I haven’t made a Piefed account before but ActivityPub (the federation protocol) is responsible for deciding what is and isn’t blocked based on your lists AFAIK so I wouldn’t expect any differences. That is to say, the included blocking features prevent the UI from receiving blocked posts, the UI shouldn’t be responsible for hiding them.














  • Cell doesn’t disable memory safety, though? It comes with additional restrictions such as being unable to share between threads (statically enforced) obviously, it’s not an unsafe feature. You also can’t read from it unless your type can be bitwise copied, etc.

    Interior mutability is mostly for making immutable interfaces that for some reason or another benefit from storing a bit of mutable state, such as for lazy evaluation. It’s also used for cross thread communication in some cases since you have to use shared (immutable) references to share things between threads.

    It requires a lot of nigh-illegible boilerplate code to even compile

    this is the entire source code for an app that performs a rather complex function, note the absence of boilerplate

    from https://codeberg.org/Mycellf/wordjoin

    use std::{
        fs::File,
        io::{self, BufRead, BufReader, Read, Write},
        path::PathBuf,
    };
    
    use clap::{Parser, ValueEnum};
    use icu_segmenter::{
        LineSegmenter, LineSegmenterBorrowed,
        options::{LineBreakOptions, LineBreakStrictness, LineBreakWordOption},
    };
    
    /// Insert utf-8 word joiners (U+2060) to prevent text from wrapping outside of whitespace characters.
    #[derive(Parser)]
    struct Args {
        /// Format and concatenate each file in stead of stdin
        file_paths: Vec<PathBuf>,
    
        /// Read stdin by line instead of all at once
        /// (sometimes worse for interactive use; files are always read by line)
        #[clap(short = 'l', long)]
        by_line: bool,
    
        /// See https://drafts.csswg.org/css-text-3/#line-break-property
        #[clap(short, long, default_value = "strict")]
        strictness: LineBreakStrictnessValues,
        /// See https://drafts.csswg.org/css-text-3/#word-break-property
        #[clap(short, long, default_value = "normal")]
        word_option: LineBreakWordOptionValues,
    
        /// Print this app's GNU GPL-3.0 license
        #[arg(short = 'L', long)]
        license: bool,
    
        /// Print this app's source code
        #[arg(short = 'S', long)]
        source: bool,
    }
    
    const WORD_JOINER: char = '\u{2060}';
    
    fn main() -> io::Result<()> {
        let args = Args::parse();
    
        if args.source || args.license {
            if args.source {
                println!(
                    "Cargo.toml:\n{config}\n\nsrc/main.rs:\n{source}\n\nREADME.md:\n{readme}",
                    config = include_str!("../Cargo.toml"),
                    source = include_str!("main.rs"),
                    readme = include_str!("../README.md"),
                );
            }
    
            if args.license {
                println!("LICENSE:\n{}", include_str!("../LICENSE"));
            }
    
            return Ok(());
        }
    
        let mut options = LineBreakOptions::default();
        options.strictness = Some(args.strictness.into());
        options.word_option = Some(args.word_option.into());
    
        let segmenter = LineSegmenter::new_auto(options);
    
        let mut stdout = io::stdout().lock();
    
        if args.file_paths.is_empty() {
            let stdin = io::stdin();
    
            if args.by_line {
                join_text_by_lines(stdout, stdin, segmenter)?;
            } else {
                join_text_by_all(stdout, stdin, segmenter)?;
            }
        } else {
            for path in args.file_paths {
                let file = File::open(path)?;
    
                join_text_by_lines(&mut stdout, file, segmenter)?;
            }
        }
    
        Ok(())
    }
    
    fn join_text_by_lines(
        mut writer: impl Write,
        text: impl Read,
        segmenter: LineSegmenterBorrowed,
    ) -> io::Result<()> {
        for line in BufReader::new(text).lines() {
            let line = line?;
    
            join_text(&mut writer, &line, segmenter)?;
            writeln!(&mut writer)?;
        }
    
        Ok(())
    }
    
    fn join_text_by_all(
        writer: impl Write,
        mut text: impl Read,
        segmenter: LineSegmenterBorrowed,
    ) -> io::Result<()> {
        let mut input = String::new();
        text.read_to_string(&mut input)?;
    
        join_text(writer, &input, segmenter)?;
    
        Ok(())
    }
    
    fn join_text(
        mut writer: impl Write,
        text: &str,
        segmenter: LineSegmenterBorrowed,
    ) -> io::Result<()> {
        let mut segments = segmenter.segment_str(text).peekable();
    
        while let (Some(start), Some(&end)) = (segments.next(), segments.peek()) {
            let segment = &text[start..end];
    
            write!(writer, "{segment}")?;
    
            if end < text.len()
                && segment
                    .chars()
                    .next_back()
                    .is_some_and(|end| !end.is_whitespace())
            {
                write!(writer, "{WORD_JOINER}")?;
            }
        }
    
        Ok(())
    }
    
    #[derive(Clone, ValueEnum)]
    enum LineBreakStrictnessValues {
        Loose,
        Normal,
        Strict,
        Anywhere,
    }
    
    impl From<LineBreakStrictnessValues> for LineBreakStrictness {
        fn from(value: LineBreakStrictnessValues) -> Self {
            match value {
                LineBreakStrictnessValues::Loose => LineBreakStrictness::Loose,
                LineBreakStrictnessValues::Normal => LineBreakStrictness::Normal,
                LineBreakStrictnessValues::Strict => LineBreakStrictness::Strict,
                LineBreakStrictnessValues::Anywhere => LineBreakStrictness::Anywhere,
            }
        }
    }
    
    #[derive(Clone, ValueEnum)]
    enum LineBreakWordOptionValues {
        Normal,
        BreakAll,
        KeepAll,
    }
    
    impl From<LineBreakWordOptionValues> for LineBreakWordOption {
        fn from(value: LineBreakWordOptionValues) -> Self {
            match value {
                LineBreakWordOptionValues::Normal => LineBreakWordOption::Normal,
                LineBreakWordOptionValues::BreakAll => LineBreakWordOption::BreakAll,
                LineBreakWordOptionValues::KeepAll => LineBreakWordOption::KeepAll,
            }
        }
    }