Files
turso/core
Pekka Enberg da96072780 Merge 'Lower ownership requirement for Value' from Levy A.
If you have a `&str` you would need to allocate and copy the string just
to pass a reference to it again. Same goes if you have a slice of bytes.
In all (most?) situations, that is not what you want and sometimes
impossible to satisfy. Example:
```rs
impl From<&str> for Value<'_> {
    fn from(value: &str) -> Self {
        Self::Text(&value.to_owned())
    }
}
```
Here, there is no way to pass a reference to a `String` without making
the lifetime `'static`, since the string has to be dropped by the end of
the function or leaked. I would consider this a anti-pattern. There is
no reason to keep a shared reference to a owned value. (And can't think
of any situation where you would need such thing)
Now, this is possible:
```rs
impl<'a> From<&'a str> for Value<'a> {
    fn from(value: &'a str) -> Self {
        Self::Text(value)
    }
}
```

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #838
2025-02-04 13:10:10 +02:00
..
2025-01-30 03:44:33 +02:00
2025-02-03 20:42:50 +02:00
2025-01-28 14:55:38 -05:00
2025-01-31 06:44:56 -05:00
2025-01-29 22:37:04 +02:00
2025-01-28 14:55:38 -05:00
2025-02-03 20:42:50 +02:00
2025-01-11 17:19:25 +02:00
2024-12-24 18:04:30 +01:00
2025-02-03 16:52:42 -03:00
2025-01-26 16:27:19 +02:00