Is it due to lifetime?
There was a draft proposal for associated statics a while ago, but I don't think anyone has been actively working on the design or implementation since then. I don't think there are fundamental obstacles; it may be more a matter of motivation and priority.
1 Like
You can approximate it with a function that returns a reference to a local static.
pub struct Foo;
impl Foo {
pub fn bar() -> &'static [u8] {
static BAR: [u8; 3] = [1, 2, 3];
&BAR
}
}
3 Likes
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.