fn send_reply(
    args: &Args<'_>,
    result: PlayResult,
    code: &str,
    flags: &CommandFlags,
    flag_parse_errors: &str,
) -> Result<(), Error> {
    let result = if !result.success {
        result.stderr
    } else if result.stderr.is_empty() {
        result.stdout
    } else {
        format!("{}\n{}", result.stderr, result.stdout)
    };

    if result.trim().is_empty() {
        api::send_reply(args, &format!("{}``` ```", flag_parse_errors))
    } else {
        crate::reply_potentially_long_text(
            args,
            &format!("{}```rust\n{}", flag_parse_errors, result),
            "```",
            &format!(
                "Output too large. Playground link: {}",
                url_from_gist(&flags, &post_gist(args, code)?),
            ),
        )
    }
}
/// Send a Discord reply with the formatted contents of a Playground result
Send a Discord reply with the formatted contents of a Playground result
Send a Discord reply with the formatted contents of a Playground result
fn send_reply(
    args: &Args<'_>,
    result: PlayResult,
    code: &str,
    flags: &CommandFlags,
    flag_parse_errors: &str,
) -> Result<(), Error> {
    let result = if !result.success {
        result.stderr
    } else if result.stderr.is_empty() {
        result.stdout
    } else {
        format!("{}\n{}", result.stderr, result.stdout)
    };
    if result.trim().is_empty() {
        api::send_reply(args, &format!("{}``` ```", flag_parse_errors))
    } else {
        crate::reply_potentially_long_text(
            args,
            &format!("{}```rust\n{}", flag_parse_errors, result),
            "```",
            &format!(
                "Output too large. Playground link: {}",
                url_from_gist(&flags, &post_gist(args, code)?),
            ),
        )
    }
}
fn send_reply ( args : & Args < ' _ > , result : PlayResult , code : & str , flags : & CommandFlags , flag_parse_errors : & str , ) -> Result < ( ) , Error > { let result = if ! result . success { result . stderr } else if result . stderr . is_empty ( ) { result . stdout } else { format ! ( " \n " result stderr result stdout ) } ; if result . trim ( ) . is_empty ( ) { api :: send_reply ( args , & format ! ( " " flag_parse_errors ) ) } else { crate :: reply_potentially_long_text ( args , & format ! ( " \n " flag_parse_errors result ) , " " , & format ! ( " " url_from_gist ( flags post_gist ( args code ) ) ) , ) } }
Send a Discord reply with the formatted contents of a Playground result
Send a Discord reply with the formatted contents of a Playground result
args
&Args<'_>
result
PlayResult
code
&str
flags
&CommandFlags
flag_parse_errors
&str
args
&Args<'_>
result
PlayResult
code
&str
flags
&CommandFlags
flag_parse_errors
&str