const std = @import("std");

pub const StringError = error{ConcatError};

/// Concatenates two strings together using `std.mem.concat()`
pub fn concat(str_1: []const u8, str_2: []const u8, allocator: std.mem.Allocator) StringError![:0]const u8 {
    const path_concat = [2][]const u8{ str_1, str_2 };

    return std.mem.concatWithSentinel(allocator, u8, &path_concat, 0) catch |e| {
        std.log.err("[{s}] Failed to concatenate the following strings: '{s}' and '{s}'\n", .{ @errorName(e), str_1, str_2 });
        return StringError.ConcatError;
    };
}
