I have tried multiple things but it is a game of guessing at this point
fn main() {
let _array: [&'static str; 4] = ["First", "Second", "Third", "Fourth"];
check_string(/*_array*/);
}
fn check_string(/*_input: ??? */) {
}
A nice way to check the type of a variable in rust is doing this:
let val: () = /* your value */;
(Playground)
Which gets you an error saying that it expected a () and not a WhatEverYourTypeIs
In this case you would get a [&'static str; 4] as you mention already in your code; so just require that in the function:
fn check_string(data: [&'static str; 4])
You could also pass a slice:
fn check_strings(data: &[&'static str])
And play with the lifetimes:
fn check_strings<'a>(data: &'a[&'a str])
etc.
To call it pass either:
check_string(_array);
If it takes a sized array or
check_strings(&_array[..]);
If it takes the slice.