git.delta.rocks / jrsonnet / refs/commits / 895de28dcfed

difftreelog

feat impl Borrow for IStr/IBytes

Yaroslav Bolyukin2023-08-06parent: #c41391d.patch.diff
in: master

2 files changed

modifiedcrates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth
6#![warn(clippy::pedantic, clippy::nursery)]6#![warn(clippy::pedantic, clippy::nursery)]
7#![allow(clippy::missing_const_for_fn)]7#![allow(clippy::missing_const_for_fn)]
8use std::{8use std::{
9 borrow::Cow,9 borrow::{Borrow, Cow},
10 cell::RefCell,10 cell::RefCell,
11 fmt::{self, Display},11 fmt::{self, Display},
12 hash::{BuildHasherDefault, Hash, Hasher},12 hash::{BuildHasherDefault, Hash, Hasher},
57 }57 }
58}58}
59
60impl Borrow<str> for IStr {
61 fn borrow(&self) -> &str {
62 self.as_str()
63 }
64}
65impl Borrow<[u8]> for IStr {
66 fn borrow(&self) -> &[u8] {
67 self.as_bytes()
68 }
69}
5970
60impl PartialEq for IStr {71impl PartialEq for IStr {
61 fn eq(&self, other: &Self) -> bool {72 fn eq(&self, other: &Self) -> bool {
135 }146 }
136}147}
148
149impl Borrow<[u8]> for IBytes {
150 fn borrow(&self) -> &[u8] {
151 self.0.as_slice()
152 }
153}
137154
138impl PartialEq for IBytes {155impl PartialEq for IBytes {
139 fn eq(&self, other: &Self) -> bool {156 fn eq(&self, other: &Self) -> bool {
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
3use jrsonnet_evaluator::{3use jrsonnet_evaluator::{
4 error::{ErrorKind::*, Result},4 error::{ErrorKind::*, Result},
5 function::{builtin, ArgLike, CallLocation, FuncVal},5 function::{builtin, ArgLike, CallLocation, FuncVal},
6 manifest::JsonFormat,
6 throw,7 throw,
7 typed::{Either2, Either4},8 typed::{Either2, Either4},
8 val::{equals, ArrValue},9 val::{equals, ArrValue},