pub trait IntoCStrArray<const N: usize>: IntoCStrArrayImpl<N> { }
Expand description

Represents an N-element array or tuple of IntoCStr types.

Used with HexChat functions that emit events, for example PluginHandle::emit_print.

This trait is sealed and cannot be implemented outside of hexavalent.

§Examples

An array containing elements of some type that implements IntoCStr:

use hexavalent::PluginHandle;
use hexavalent::event::print::ChannelMessage;

fn emit_fake_print<P>(ph: PluginHandle<'_, P>) {
    ph.emit_print(ChannelMessage, ["user", "hello", "@", "$"]);
}

A tuple containing different types that implement IntoCStr:

use hexavalent::PluginHandle;
use hexavalent::event::print::ChannelMessage;

fn emit_fake_print<P>(ph: PluginHandle<'_, P>, user: &str) {
    ph.emit_print(ChannelMessage, (user, format!("hello from {user}"), c"@", c"$"));
}

Implementations on Foreign Types§

source§

impl IntoCStrArray<0> for ()

source§

impl<A> IntoCStrArray<1> for (A,)
where A: IntoCStr,

source§

impl<A, B> IntoCStrArray<2> for (A, B)
where A: IntoCStr, B: IntoCStr,

source§

impl<A, B, C> IntoCStrArray<3> for (A, B, C)
where A: IntoCStr, B: IntoCStr, C: IntoCStr,

source§

impl<A, B, C, D> IntoCStrArray<4> for (A, B, C, D)
where A: IntoCStr, B: IntoCStr, C: IntoCStr, D: IntoCStr,

source§

impl<S, const N: usize> IntoCStrArray<N> for [S; N]
where S: IntoCStr,

Implementors§