From 51e319962c49b43c68d6e8bacf00764fdc352eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Pinz=C3=B3n=20Pardo?= Date: Thu, 29 Jun 2023 21:52:47 -0500 Subject: [PATCH 1/5] Ordered spans example --- content/en/examples/spans.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/examples/spans.md b/content/en/examples/spans.md index 2698a8f..0c21ed5 100644 --- a/content/en/examples/spans.md +++ b/content/en/examples/spans.md @@ -1,6 +1,6 @@ --- title: "spans" -date: 2023-06-21T11:05:00-03:00 +weight: 245 draft: false --- From b4a49efb31c97ba23a9cc8e4265b1e9a7d80bcff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Pinz=C3=B3n=20Pardo?= Date: Thu, 29 Jun 2023 21:54:37 -0500 Subject: [PATCH 2/5] Add spans (es) --- content/es/examples/spans.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 content/es/examples/spans.md diff --git a/content/es/examples/spans.md b/content/es/examples/spans.md new file mode 100644 index 0000000..3d2a798 --- /dev/null +++ b/content/es/examples/spans.md @@ -0,0 +1,33 @@ +--- +title: "Spans" +weight: 245 +draft: false +--- + +La estructura `Span` es una instantánea (o snapshot) de un `arreglo` +Todos los métodos para arreglos pueden usarse para esta estructura, con la excepción del método `append()`. + +Para crear el `Span` de un `arreglo`, use el método `span()`. + +Modificación del ejemplo [snapshots](./snapshots.md): + +```rust {.codebox} +use array::ArrayTrait; +use array::SpanTrait; + +// Recibe un spam +fn sum_starting_two(dato: Span) -> u32 { + // data.append(5_u32); <- Esto falla! + *dato[0] + *dato[1] +} + +fn main() -> u32 { + let mut dato: Array = ArrayTrait::new(); + dato.append(1_u32); + dato.append(2_u32); + dato.append(3_u32); + dato.append(4_u32); + dato.get(0); + sum_starting_two(dato.span()) // Usando el spam +} +``` From f94c43a64498d5ad5d775e180ecd001307f472fb Mon Sep 17 00:00:00 2001 From: marcos <70913815+MarPinPar@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:21:58 -0500 Subject: [PATCH 3/5] Update content/es/examples/spans.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomás <47506558+MegaRedHand@users.noreply.github.com> --- content/es/examples/spans.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/es/examples/spans.md b/content/es/examples/spans.md index 3d2a798..ae2c319 100644 --- a/content/es/examples/spans.md +++ b/content/es/examples/spans.md @@ -15,7 +15,7 @@ Modificación del ejemplo [snapshots](./snapshots.md): use array::ArrayTrait; use array::SpanTrait; -// Recibe un spam +// Recibe un span fn sum_starting_two(dato: Span) -> u32 { // data.append(5_u32); <- Esto falla! *dato[0] + *dato[1] From 1881b6e2911b44c26cae5bf84b28e436bddc7900 Mon Sep 17 00:00:00 2001 From: marcos <70913815+MarPinPar@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:22:13 -0500 Subject: [PATCH 4/5] Update content/es/examples/spans.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomás <47506558+MegaRedHand@users.noreply.github.com> --- content/es/examples/spans.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/es/examples/spans.md b/content/es/examples/spans.md index ae2c319..fc5b755 100644 --- a/content/es/examples/spans.md +++ b/content/es/examples/spans.md @@ -17,7 +17,7 @@ use array::SpanTrait; // Recibe un span fn sum_starting_two(dato: Span) -> u32 { - // data.append(5_u32); <- Esto falla! + // dato.append(5_u32); <- Esto falla! *dato[0] + *dato[1] } From 602a1238aa12372ee13f5c961b29533e113ce572 Mon Sep 17 00:00:00 2001 From: marcos <70913815+MarPinPar@users.noreply.github.com> Date: Wed, 5 Jul 2023 12:22:19 -0500 Subject: [PATCH 5/5] Update content/es/examples/spans.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomás <47506558+MegaRedHand@users.noreply.github.com> --- content/es/examples/spans.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/es/examples/spans.md b/content/es/examples/spans.md index fc5b755..b357d19 100644 --- a/content/es/examples/spans.md +++ b/content/es/examples/spans.md @@ -28,6 +28,6 @@ fn main() -> u32 { dato.append(3_u32); dato.append(4_u32); dato.get(0); - sum_starting_two(dato.span()) // Usando el spam + sum_starting_two(dato.span()) // Usando el span } ```