From d89e0ff8eee0b1ec5a1cd45bda43ff496a0ec1d6 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Fri, 10 Nov 2023 22:58:29 +0530 Subject: [PATCH] fix docs --- sway-lib-std/src/array_conversions/b256.sw | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sway-lib-std/src/array_conversions/b256.sw b/sway-lib-std/src/array_conversions/b256.sw index 1d65b0ed044..0019d303150 100644 --- a/sway-lib-std/src/array_conversions/b256.sw +++ b/sway-lib-std/src/array_conversions/b256.sw @@ -14,14 +14,15 @@ impl b256 { /// /// ```sway /// fn foo() { - /// let bytes = [32_u8, 31_u8, 30_u8, 29_u8, 28_u8, 27_u8, 26_u8, 25_u8, 24_u8, 23_u8, - /// 22_u8, 21_u8, 20_u8, 19_u8, 18_u8, 17_u8, 16_u8, 15_u8, 14_u8, 13_u8, - /// 12_u8, 11_u8, 10_u8, 9_u8, 8_u8, 7_u8, 6_u8, 5_u8, 4_u8, 3_u8, - /// 2_u8, 1_u8]; + /// let x = b256::new(0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20); /// - /// let x = b256::from_le_bytes(bytes); + /// let bytes = x.to_le_bytes(); /// - /// assert(x == 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20); + /// let mut i: u8 = 0; + /// while i < 32_u8 { + /// assert(bytes[i.as_u64()] == 32_u8 - i); + /// i += 1_u8; + /// } /// } /// ``` pub fn to_le_bytes(self) -> [u8; 32] {