Skip to content

Commit d813905

Browse files
author
Guillaume Fraux
committed
Use the right lifetime rules for split_at and friends
They look different from the standard library definition, as the standard library functions are defined on the unsized [T]
1 parent cfe6060 commit d813905

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

soa-derive-internal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "soa_derive_internal"
3-
version = "0.6.2"
3+
version = "0.6.3"
44
authors = ["Guillaume Fraux <guillaume.fraux@chimie-paristech.fr>"]
55
license = "MIT/Apache-2.0"
66
readme = "../README.md"

soa-derive-internal/src/slice.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn derive_slice(input: &Input) -> TokenStream {
8080
/// Similar to [`
8181
#[doc = #slice_name_str]
8282
/// ::first()`](https://doc.rust-lang.org/std/primitive.slice.html#method.first).
83-
pub fn first(&self) -> Option<#ref_name> {
83+
pub fn first(&self) -> Option<#ref_name<'a>> {
8484
if self.is_empty() {
8585
None
8686
} else {
@@ -94,7 +94,7 @@ pub fn derive_slice(input: &Input) -> TokenStream {
9494
/// Similar to [`
9595
#[doc = #slice_name_str]
9696
/// ::split_first()`](https://doc.rust-lang.org/std/primitive.slice.html#method.split_first).
97-
pub fn split_first(&self) -> Option<(#ref_name, #slice_name)> {
97+
pub fn split_first(&self) -> Option<(#ref_name<'a>, #slice_name<'a>)> {
9898
if self.is_empty() {
9999
None
100100
} else {
@@ -110,7 +110,7 @@ pub fn derive_slice(input: &Input) -> TokenStream {
110110
/// Similar to [`
111111
#[doc = #slice_name_str]
112112
/// ::last()`](https://doc.rust-lang.org/std/primitive.slice.html#method.last).
113-
pub fn last(&self) -> Option<#ref_name> {
113+
pub fn last(&self) -> Option<#ref_name<'a>> {
114114
if self.is_empty() {
115115
None
116116
} else {
@@ -124,7 +124,7 @@ pub fn derive_slice(input: &Input) -> TokenStream {
124124
/// Similar to [`
125125
#[doc = #slice_name_str]
126126
/// ::split_last()`](https://doc.rust-lang.org/std/primitive.slice.html#method.split_last).
127-
pub fn split_last(&self) -> Option<(#ref_name, #slice_name)> {
127+
pub fn split_last(&self) -> Option<(#ref_name<'a>, #slice_name<'a>)> {
128128
if self.is_empty() {
129129
None
130130
} else {
@@ -140,7 +140,7 @@ pub fn derive_slice(input: &Input) -> TokenStream {
140140
/// Similar to [`
141141
#[doc = #slice_name_str]
142142
/// ::split_at()`](https://doc.rust-lang.org/std/primitive.slice.html#method.split_at).
143-
pub fn split_at(&self, mid: usize) -> (#slice_name, #slice_name) {
143+
pub fn split_at(&self, mid: usize) -> (#slice_name<'a>, #slice_name<'a>) {
144144
#(
145145
let (#slice_names_1, #slice_names_2) = self.#fields_names_2.split_at(mid);
146146
)*

0 commit comments

Comments
 (0)