directly match string instead of allocating a complete lowercase string
This commit is contained in:
parent
fabd53423e
commit
b96b26bb2d
@ -16,9 +16,10 @@ impl std::str::FromStr for RobloxAssetId{
|
|||||||
"rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(),
|
"rbxassetid"=>url.domain().ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?.parse(),
|
||||||
"http"|"https"=>{
|
"http"|"https"=>{
|
||||||
let (_,asset_id)=url.query_pairs()
|
let (_,asset_id)=url.query_pairs()
|
||||||
.find(|(id,_)|
|
.find(|(id,_)|match id.as_ref(){
|
||||||
id.to_lowercase()=="id"
|
"ID"|"id"|"Id"|"iD"=>true,
|
||||||
).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?;
|
_=>false,
|
||||||
|
}).ok_or_else(||RobloxAssetIdParseErr::MissingAssetId(s.to_owned()))?;
|
||||||
asset_id.parse()
|
asset_id.parse()
|
||||||
},
|
},
|
||||||
_=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?,
|
_=>Err(RobloxAssetIdParseErr::UnknownScheme(s.to_owned()))?,
|
||||||
|
Loading…
Reference in New Issue
Block a user