Closed sweep-ai[bot] closed 10 months ago
for iter() i want you to return a js Array or even a js Iterator instead of a flat rust Iterator
Done.
error[E0308]: mismatched types --> src/library.rs:14:46 | 14 | self.0.nth(n).map( | entry | Entry { 0: entry }) | ^^^^^ expected Entry , found &Entry |
---|
help: consider using clone here | 14 | self.0.nth(n).map(|entry| Entry { 0: entry.clone() }) | ++++++++
error[E0599]: no function or associated item named from_serde found for struct wasm_bindgen::JsValue in the current scope
--> src/library.rs:35:44 |
35 | self.0.iter().map( | entry | JsValue::from_serde(&Entry { 0: entry.clone() }).unwrap()).collect:: |
^^^^^^^^^^ |
---|---|---|---|---|---|
function or associated item not found in JsValue |
|||||
help: there is an associated function with a similar name: from_str |
Done.
PR Feedback (click)
Description
This pull request adds the remaining methods to the
Library
struct in thesrc/library.rs
file. These methods includenth
,is_empty
,len
,remove
,keys
,iter
, andnew
. Additionally, thepush
method has been modified to take a reference to anEntry
object.Summary
nth
method to retrieve the nth entry in the library.is_empty
method to check if the library is empty.len
method to get the number of entries in the library.remove
method to remove an entry from the library.keys
method to retrieve an iterator of the keys in the library.iter
method to retrieve an iterator of the entries in the library.push
method to take a reference to anEntry
object.new
method to create a new instance of theLibrary
struct.Fixes #2.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: