aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Sacchini <joey@sacchini.net>2021-01-01 16:55:02 -0500
committerJoey Sacchini <joey@sacchini.net>2021-01-01 16:55:02 -0500
commit44f0ccc9a8863e3d92a4c02e9f3c7dbe6412f244 (patch)
tree7af759663beaf89c7e87d95b72b66a5b6c4862c8
parent606d52dfe675c21c735157b1da1fc0634b1daaeb (diff)
downloadmcproto-rs-44f0ccc9a8863e3d92a4c02e9f3c7dbe6412f244.tar.gz
mcproto-rs-44f0ccc9a8863e3d92a4c02e9f3c7dbe6412f244.tar.bz2
mcproto-rs-44f0ccc9a8863e3d92a4c02e9f3c7dbe6412f244.zip
fix status parsing
-rw-r--r--src/status.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/status.rs b/src/status.rs
index 08e3e71..274fcbe 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -116,7 +116,7 @@ impl<'de> Deserialize<'de> for StatusFaviconSpec {
fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
// favicon syntax data:{content-type};base64,{}
let v = str_tag(v, "data:", &self)?;
- let content_type = str_until_pat(v, ";", &self)?;
+ let (content_type, v) = str_until_pat(v, ";", &self)?;
let rest = str_tag(v, "base64,", &self)?;
match base64::decode(rest) {
Ok(data) => {
@@ -156,7 +156,7 @@ fn str_until_pat<'a, E, V>(
target: &'a str,
pat: &str,
v: &V,
-) -> Result<&'a str, E> where
+) -> Result<(&'a str, &'a str), E> where
E: serde::de::Error,
V: serde::de::Visitor<'a>
{
@@ -168,7 +168,7 @@ fn str_until_pat<'a, E, V>(
for i in 0..=(target.len()-n_pat) {
let v = &target[i..i+n_pat];
if v == pat {
- return Ok(&target[..i]);
+ return Ok((&target[..i], &target[i+1..]));
}
}