Received: (at 73279-done) by debbugs.gnu.org; 13 Feb 2025 10:29:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 13 05:29:01 2025 Received: from localhost ([127.0.0.1]:40795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tiWSr-0006O8-6e for submit <at> debbugs.gnu.org; Thu, 13 Feb 2025 05:29:01 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:61846) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1tiWSo-0006Nf-Hj for 73279-done <at> debbugs.gnu.org; Thu, 13 Feb 2025 05:28:59 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5de4d3bbc76so1068546a12.3 for <73279-done <at> debbugs.gnu.org>; Thu, 13 Feb 2025 02:28:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739442532; x=1740047332; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=fFMnjRvU/g7oLgoT3ICmd6S1EawhZhFoCEKnxOKf8OU=; b=VqXhuQ1Rs4vuoQFJmMgz+0dguu07P9VjBKPE7rkYMJtkA0P6v9SAJmQXQxXpTDMocR RSCv14rVeCXupg+Ljdr/aoAKTbQpAq6xA3PSL5qD+XLaYoprc7Ta1j96OTrxybr3yQ5T /dP7QWwAvdXuH0otbBwT3vptDdbKy4foeZQaTaW6Ta+zby5AjDFDIKeXh7138H6WnjPM NzBNRTIW5kHHIo2oGXCXGwVv9i7+AmaH7/8jDzRn3id/6sFXT0k9DlBZQDtFk/859UQA 2ngTV4z631/JZL4ao1lWu/xFqVdasqvR7/DDLe+MvvXhewCTpqscgpxSlQNM036ebdH0 TrHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739442532; x=1740047332; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fFMnjRvU/g7oLgoT3ICmd6S1EawhZhFoCEKnxOKf8OU=; b=FQqGpCbafB8G5c7PJSVOOEd4wUf1162pkzViC94G/enPHyDtgXKbA3YCNgsYexwV/T jrfkwu1jxPKGYt8rCDVfOr0BCgiimqHGfJZK9fH3I+XZdgsekD4jWpK0vCn16gjLv1MJ jxBALEB0XkMWCjS1V1WBBcH8GAa1BAyCDSKfmm8X/lXFe09Fkmkx6iOoxxRKowYtrZb1 bz36hRoopfsHt9/L4YwFmc6WAhPWKoPk3Fi9BRVKJ+neYi+G1KYfkZ40936amtKOG0G3 Q1WljXceRIzEIQ7HFqodq90tFj2yqUptQFANlWkcJHHYEBUJvx4mpqhQwfwJUpjkWe5E 0THw== X-Forwarded-Encrypted: i=1; AJvYcCW/b8IX/tmPUvruNkusAC20VsT3pZsjJojc5i2VutEW1Jst314eTBixjuIEdlUDabDmF5F6VnycH9Ty <at> debbugs.gnu.org X-Gm-Message-State: AOJu0YyT4WCZYjxNa+/g+X98XJxVNlPYrB+ig2myGDkk6HwAiTKB25fY hV2s5XPr0viGr7R47/jjLgBM/ntU/DmyR/xT8x5A+kY+OOTrSl3bx1yQhHkhCZrXKzZjFpPsHJ2 tm7epqXhmP47ipHJzZy+4A+vwOgQ= X-Gm-Gg: ASbGncs1bss5Q/EaQAHJjWP+bnFs98UGRlHxEylnw/BkX3nYO/7qYkY6eDaaeFXyq6g W37JGKWOx+V/XxxCXUjRZozLLkw9slwBcOxHxcx6j4/MA9I8tQ7BVkLE4vQ1ayA6oN7K/iWtQNf 8= X-Google-Smtp-Source: AGHT+IF0YZpUo9oiRIkQgrKfOuhzwxscf9H8IBCXRzAtT6gUXLssiFiyTM+aTDNX0kya6vfS9tKM2y8/0TYd1dVYxfQ= X-Received: by 2002:a05:6402:50cc:b0:5dc:c9ce:b01b with SMTP id 4fb4d7f45d1cf-5deadd8810dmr5627624a12.8.1739442531918; Thu, 13 Feb 2025 02:28:51 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 13 Feb 2025 02:28:51 -0800 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <87r08pv5ke.fsf@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> <861q16bs1s.fsf@HIDDEN> <87h69pcttr.fsf@HIDDEN> <CALDnm51iGW+fCicsqEgzJLpG==XaUAdEJw7Hg5fhQ+00qp0RtQ@HIDDEN> <87r08pv5ke.fsf@HIDDEN> MIME-Version: 1.0 Date: Thu, 13 Feb 2025 02:28:51 -0800 X-Gm-Features: AWEUYZm940NR-e-3xuMFUJFwOh_HUmq4NVcDCxN4Q4rm26kBayEaNrVhY0z2nwU Message-ID: <CADwFkmmk-dASyEyQAdCnaizrvxF-oY8jXAUvEi79AeFGs7atvA@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73279-done Cc: Eli Zaretskii <eliz@HIDDEN>, dgutov@HIDDEN, =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>, 73279-done <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) "Brennan Vincent" <brennan@HIDDEN> writes: > Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes: > >> On Sun, Oct 6, 2024 at 1:14=E2=80=AFPM Brennan Vincent <brennan@umanwiza= rd.com> wrote: >>> >>> Hi all, >>> >>> Looks like this still hasn't been pushed to emacs-30 as of today. >> >> Sorry Brennan this delay was my bad again. I found a bit of time today = and >> I just pushed your patch. >> >> Jo=C3=A3o > > Thanks! It seems like the patch was pushed, so I'm closing this bug report now.
Brennan Vincent <brennan@HIDDEN>
:Stefan Kangas <stefankangas@HIDDEN>
:Received: (at 73279) by debbugs.gnu.org; 9 Oct 2024 12:12:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 09 08:12:29 2024 Received: from localhost ([127.0.0.1]:55871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1syVYL-0003VM-6j for submit <at> debbugs.gnu.org; Wed, 09 Oct 2024 08:12:29 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]:50752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1syVYI-0003V5-Ls for 73279 <at> debbugs.gnu.org; Wed, 09 Oct 2024 08:12:28 -0400 Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 9 Oct 2024 12:12:03 +0000 X-Fes-Received-For: 73279 <at> debbugs.gnu.org X-Fes-Received-From: <brennan@HIDDEN> From: "Brennan Vincent" <brennan@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve In-Reply-To: <CALDnm51iGW+fCicsqEgzJLpG==XaUAdEJw7Hg5fhQ+00qp0RtQ@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> <861q16bs1s.fsf@HIDDEN> <87h69pcttr.fsf@HIDDEN> <CALDnm51iGW+fCicsqEgzJLpG==XaUAdEJw7Hg5fhQ+00qp0RtQ@HIDDEN> Date: Wed, 09 Oct 2024 08:12:01 -0400 Message-ID: <87r08pv5ke.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes: > On Sun, Oct 6, 2024 at 1:14=E2=80=AFPM Brennan Vincent <brennan@umanwizar= d.com> wrote: >> >> Hi all, >> >> Looks like this still hasn't been pushed to emacs-30 as of today. > > Sorry Brennan this delay was my bad again. I found a bit of time today a= nd > I just pushed your patch. > > Jo=C3=A3o Thanks!
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 9 Oct 2024 11:51:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 09 07:51:34 2024 Received: from localhost ([127.0.0.1]:55836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1syVE5-0002RT-U9 for submit <at> debbugs.gnu.org; Wed, 09 Oct 2024 07:51:34 -0400 Received: from mail-oo1-f48.google.com ([209.85.161.48]:43447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1syVE3-0002RA-7r for 73279 <at> debbugs.gnu.org; Wed, 09 Oct 2024 07:51:32 -0400 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5e7ff0f41caso394106eaf.1 for <73279 <at> debbugs.gnu.org>; Wed, 09 Oct 2024 04:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728474615; x=1729079415; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZGEO0OFIBH+u6sa1H+1+eGIm8pXq09SREPfTEbdzHAI=; b=dp80Out8lwfGhzK/Kag9w2VjlokzRBq12PVMdzF9Hpis1+vyUxswkMnhpewwGdLeZy skrz8K6xeK55Nn/y4PwoFViOf8pzgHBcSgUkFWmwcF/eFa3T/G2OFuxF4k927GtudGDy WVrLVfkILzLcSZ/jboONeJFctwNbMUh1ghGbhsnxcVXBu6uRdEvRNsdR427kcV/orA9E jePWhHQbRA5FGWiGWETqv/djhdf7myZKFf7TQF87Wp8xLpYIceTMba7AQ+pm0/PFigd0 iFA737KwtkknvhFKF1/ZwC+Dp2VTian2gjLHadGI6biksd7O7PxHQSdqPBGH0PqImgEU jPcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728474615; x=1729079415; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZGEO0OFIBH+u6sa1H+1+eGIm8pXq09SREPfTEbdzHAI=; b=LTGmmYiRKumle94unJIUGIjNvW97fLXn3MW6gf5F/To3AYgGrbOwUTEhmFirFufShB Einfg6N47AjjzdkGhPpVspkUCgiQmfvUnCpFH0/Vkj2wO5Dtp64/LjhrMX1W5dzeMl3Z SEdDALPIiJYaRyyO+jYg+gnksmjUXn4i/FsRFISmSQCB5uvARhHbNzmtKtCbeHBWLU2H /BVThD/hs8F9blV1uBbwrqGdbOrv7fHI0ZZ1aQYYCoAKE6CeJ7sy1JBmDpC26MevhFQe VD1hoMbr5Pnrhlt7KBaooDshciEL+qZ7w/WX/vQpsyabwxGcq4Dg9ZUy03/ArV2GzyEX RmWg== X-Forwarded-Encrypted: i=1; AJvYcCVWqrFfXE5zHagxJsa9B30mxdOUUrr2vTHKbIduZq6bRCt7YxQvvaRTgxIhtrbtxJm3CNZ9yQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yyzb+h2ANGRtJSGUEXjC/woMS0x9ASXkCvAiR2rrWEODVaCxGJE qtegiCCAr8ItQMyNsp+vBax48JS6ysyV8lPcxtp+Nd7IQaAbrogU3ytPVPU27jcbrDagtj48qXB ahUOdSDLJmBE5xXT/BiF4JZz8Tm0= X-Google-Smtp-Source: AGHT+IEJmr69qFgZbH10WJkGbCAHPLdVNr9SGfZ0oVqDsT2JdTmwCT8FqWaR4eYTKTS2iBXFdcVSJkTHMrbn+lN3EC8= X-Received: by 2002:a05:6870:d88f:b0:288:3915:db28 with SMTP id 586e51a60fabf-2883915f16fmr794032fac.5.1728474615427; Wed, 09 Oct 2024 04:50:15 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> <861q16bs1s.fsf@HIDDEN> <87h69pcttr.fsf@HIDDEN> In-Reply-To: <87h69pcttr.fsf@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Wed, 9 Oct 2024 12:50:03 +0100 Message-ID: <CALDnm51iGW+fCicsqEgzJLpG==XaUAdEJw7Hg5fhQ+00qp0RtQ@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Sun, Oct 6, 2024 at 1:14=E2=80=AFPM Brennan Vincent <brennan@umanwizard.= com> wrote: > > Hi all, > > Looks like this still hasn't been pushed to emacs-30 as of today. Sorry Brennan this delay was my bad again. I found a bit of time today and I just pushed your patch. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 6 Oct 2024 12:14:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 06 08:14:15 2024 Received: from localhost ([127.0.0.1]:40377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sxQ9O-00051o-Vg for submit <at> debbugs.gnu.org; Sun, 06 Oct 2024 08:14:15 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]:57043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1sxQ9M-00051W-KZ for 73279 <at> debbugs.gnu.org; Sun, 06 Oct 2024 08:14:13 -0400 Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 6 Oct 2024 12:13:54 +0000 X-Fes-Received-For: 73279 <at> debbugs.gnu.org X-Fes-Received-From: <brennan@HIDDEN> From: "Brennan Vincent" <brennan@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN>, =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve In-Reply-To: <861q16bs1s.fsf@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> <861q16bs1s.fsf@HIDDEN> Date: Sun, 06 Oct 2024 13:13:52 +0100 Message-ID: <87h69pcttr.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: 73279 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi all, Looks like this still hasn't been pushed to emacs-30 as of today. Thanks Brennan Eli Zaretskii <eliz@HIDDEN> writes: >> From: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> >> Date: Thu, 26 Sep 2024 11:27:29 +0100 >> Cc: Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN>, 73279= @debbugs.gnu.org >>=20 >> On Wed, Sep 25, 2024 at 4:14=E2=80=AFPM Brennan Vincent <brennan@umanwiz= ard.com> wrote: >> > >> > Hi Jo=C3=A3o, >> > >> > Did you get a chance to take a look at my last message? Let me know if= I >> > need to provide any further information. >> > >> > Thanks >> > Brennan >>=20 >> Sorry, Brennan, this slipped through the cracks. I'm 99% sure your >> patch is the right >> thing, but I haven't had time to test it properly. I think we should >> push it. To emacs-30? >> Or to master? I'd say emacs-30, but someone let me know if that's close= d now >> or something like that. > > emacs-30 is okay for this patch, thanks.
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 26 Sep 2024 10:58:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 26 06:58:55 2024 Received: from localhost ([127.0.0.1]:56028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1stmD0-00068L-VQ for submit <at> debbugs.gnu.org; Thu, 26 Sep 2024 06:58:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1stmCy-000681-HX for 73279 <at> debbugs.gnu.org; Thu, 26 Sep 2024 06:58:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1stmCR-00073h-3o; Thu, 26 Sep 2024 06:58:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=4uiBmdMMtVKSIj9HpuZnBOEacz+W2S4PGDq/v1BzoAY=; b=ZF4srqgL6jJjKl3yHpQn u+Cp8i8EM5p4Ek17WNPiWu+AilGWWmEriFAusrpXspPqtzyC6G1qYpIUirclTu8pC+72z/UMrNcU2 ze4CPDnsiWaJRTJLnI81MyZjutcZEzORMfFVplCacWuWonE7ye8NweHZoG+qwqZx/j2WBlnNp4CvV tTNrP2cZngk7XeBEcts/T/a1dXEXJjQjKFsViScso+AwdCUn+v59n75mjy80RAfjORWBpuOUAMR9Z 6bghStUTQ2VL/2Ed7Ot12KtQ1WfHOH3DuHHx573roreXA1jtqr53alwFlliAAUM6aDjSXyPNe1KTZ V+y1Drvhk6RDGQ==; Date: Thu, 26 Sep 2024 13:58:07 +0300 Message-Id: <861q16bs1s.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> In-Reply-To: <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Thu, 26 Sep 2024 11:27:29 +0100) Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73279 Cc: brennan@HIDDEN, 73279 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: João Távora <joaotavora@HIDDEN> > Date: Thu, 26 Sep 2024 11:27:29 +0100 > Cc: Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN>, 73279 <at> debbugs.gnu.org > > On Wed, Sep 25, 2024 at 4:14 PM Brennan Vincent <brennan@HIDDEN> wrote: > > > > Hi João, > > > > Did you get a chance to take a look at my last message? Let me know if I > > need to provide any further information. > > > > Thanks > > Brennan > > Sorry, Brennan, this slipped through the cracks. I'm 99% sure your > patch is the right > thing, but I haven't had time to test it properly. I think we should > push it. To emacs-30? > Or to master? I'd say emacs-30, but someone let me know if that's closed now > or something like that. emacs-30 is okay for this patch, thanks.
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 26 Sep 2024 10:29:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 26 06:29:14 2024 Received: from localhost ([127.0.0.1]:55613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1stlkI-0004O6-3o for submit <at> debbugs.gnu.org; Thu, 26 Sep 2024 06:29:14 -0400 Received: from mail-oa1-f50.google.com ([209.85.160.50]:46322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1stlkG-0004Nr-JW for 73279 <at> debbugs.gnu.org; Thu, 26 Sep 2024 06:29:13 -0400 Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-278279a3a39so419117fac.0 for <73279 <at> debbugs.gnu.org>; Thu, 26 Sep 2024 03:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727346460; x=1727951260; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=V+IpE7WAG5JIPA38Vsp7MCoqZ6DY6/rRqQVAbVjtM50=; b=ZcHbAYYCdsce7f2epLbTQE9X0Czye1QcLMhlQJs6tjykXLzxfbrdaN7Zpr+Xr5yDC5 t3GFgmVZWaa11nmjVlCJIAaQQZ+jHrVER/mhSThBPbKTdASF4rgWt3er4v6FOOnTgayB OVWKEi3KcSOKxjPrwRhUSOIM+WXH2LknQAbrrzpGghB+kpwM9+XJogrR3UMcBju3UV9d myV3qKFRattEHWpr4r08589St5T41iPLtK+yZh73ihwIqQmmCZ+HvrSHP31cg7hmWyxi isyosKHG7c64YaZwDEBUr8c2DVDE2u6AS16Natgx5nnQ6yv178ex6KMCFLffYEs37+Er kIvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727346460; x=1727951260; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V+IpE7WAG5JIPA38Vsp7MCoqZ6DY6/rRqQVAbVjtM50=; b=BglYGdnhs7uoyDt2KbadVto0eBMMILjbFxdM7GUHXPOomBBcjSAF23ANOQkDsFR45n 1w3tckMjZPUqdLvx/y2Kz55KG2aQxoDPYZp2JLQ26zi6MUWtLzWxrEcmff0EaHdNWvgB NLuWmMtbsIeZIdD869kkt/IS0PJnMHXBpBptO8yyi+6KTrAJ8MuUiaM+KOa5i/nRIJzo NArCPpty1EziVXERRbEOCypdv6lmyV7a+42ft6NYvKJf1eer710nQynKiz4+Nifvxlhj TPUzHF7lwwJ+D7yYMY2L6TelhDn7cdLp8cKJ2YRyM9jSqK0mLoEeRCFoBSvqNYptL53U XJvg== X-Forwarded-Encrypted: i=1; AJvYcCX+7m8uirLJNoFOx7KRKUMSjox1kjq3Cqs5WWIddC9fH+6dfJN/nS8Ayjo6SZCQZ7t5RdbM2A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyRMcariXccy05ulHeACgQ+sTQ7f9XGBpNUDZen9v3siO6iA2/1 DUfrSoijgX9/J1s+oM77cCS50RIjIBdRz419chz85U3raqEwsML/s2XwtEdYZWdsGtjhJ8SSk4J hX4GBrVYjzKSqMSiQEqdbnROCxouyEQ== X-Google-Smtp-Source: AGHT+IFchD50U02K1AllMfKBMnSrezokcrj30ABub66zzBVjq6a62NPBIBAz5Zpx3vgFmDfYXjiTg2+kDju739+Ieps= X-Received: by 2002:a05:6870:a70d:b0:277:e493:d7dc with SMTP id 586e51a60fabf-286e1429d3amr4184142fac.23.1727346460082; Thu, 26 Sep 2024 03:27:40 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> <877caz935s.fsf@HIDDEN> In-Reply-To: <877caz935s.fsf@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Thu, 26 Sep 2024 11:27:29 +0100 Message-ID: <CALDnm53z+ckii-rPqTyQ=FKfmbaYOVjK4eCwB6Wp_TTGRpMcfQ@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Wed, Sep 25, 2024 at 4:14=E2=80=AFPM Brennan Vincent <brennan@umanwizard= .com> wrote: > > Hi Jo=C3=A3o, > > Did you get a chance to take a look at my last message? Let me know if I > need to provide any further information. > > Thanks > Brennan Sorry, Brennan, this slipped through the cracks. I'm 99% sure your patch is the right thing, but I haven't had time to test it properly. I think we should push it. To emacs-30? Or to master? I'd say emacs-30, but someone let me know if that's closed n= ow or something like that. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 25 Sep 2024 15:15:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 25 11:15:09 2024 Received: from localhost ([127.0.0.1]:42974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1stTjR-0001so-04 for submit <at> debbugs.gnu.org; Wed, 25 Sep 2024 11:15:09 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]:50962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1stTjG-0001rn-1B for 73279 <at> debbugs.gnu.org; Wed, 25 Sep 2024 11:15:07 -0400 Received: from localhost ([98.167.244.13]) by smtp.umanwizard.com ; 25 Sep 2024 15:14:08 +0000 X-Fes-Received-For: 73279 <at> debbugs.gnu.org X-Fes-Received-From: <brennan@HIDDEN> From: "Brennan Vincent" <brennan@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve In-Reply-To: <87y13r5xzk.fsf@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> <87y13r5xzk.fsf@HIDDEN> Date: Wed, 25 Sep 2024 11:14:07 -0400 Message-ID: <877caz935s.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Jo=C3=A3o, Did you get a chance to take a look at my last message? Let me know if I need to provide any further information. Thanks Brennan "Brennan Vincent" <brennan@HIDDEN> writes: > Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes: > >> On Mon, Sep 16, 2024 at 4:50=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavor= a@HIDDEN> wrote: >>> >>> On Mon, Sep 16, 2024 at 4:40=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavo= ra@HIDDEN> wrote: >>> > >>> > On Mon, Sep 16, 2024 at 4:17=E2=80=AFPM Brennan Vincent <brennan@uman= wizard.com> wrote: >>> > >>> > > As for the regression: yes, it's a regression from 29.4, and in fac= t I >>> > > have bisected to the commit that regressed it: >>> > > a8c1559a663d9bc21776e33303251e244f86f0d7 >>> > >>> > Oh alright, that clears it up. It was an oversight indeed, so I think >>> > your patch is TRT. I'll install it in emacs-30. >>> >>> Actually, not so fast. The code before that allegedly broken commit >>> _also_ sent outstanding changes to the server before resolving >>> (via the advice that was then removed). > > Not according to my testing. > > And, taking a look at the old code: > > (advice-add #'jsonrpc-request :before > (cl-function (lambda (_proc _method _params &key > deferred &allow-other-keys) > (when (and eglot--managed-mode deferred) > (eglot--signal-textDocument/didChange)))) > '((name . eglot--signal-textDocument/didChange))) > > It seems that we are only sending the changes if the function is called > with the :deferred flag. The function was NOT called with the :deferred > flag at the site in question, which as of 093a36 (parent of a8c1559) > looked like this: > > (jsonrpc-request server :completionItem/resolve > lsp-comp :cancel-on-input t) > >>> >>> So I must be missing something, and must investigate more >>> closely. >> >> Brennan, can you provide an excerpt of the Eglot event log >> (M-x eglot-events-buffer) for your MRE recipe before and >> after a8c1559a663d9bc21776e33303251e244f86f0d7? >> > > Sure. See attachments. They are a bit long because of the huge doc > strings rust-analyzer includes, but you should get the idea by searching > for textDocument/completion. > > Note that in BEFORE, we send textDocument/completion, immediately followe= d by > completionItem/resolve. In AFTER, we send textDocument/completion, then > textDocument/didChange, then completionItem/resolve. > > (snip) > >> It should highlight what has changed in the client-server >> communication, if anything. >> >> Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 17:07:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 13:07:39 2024 Received: from localhost ([127.0.0.1]:53180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqFCN-0003oV-4v for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 13:07:39 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]:29613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1sqFCL-0003oE-Cc for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 13:07:37 -0400 Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 16 Sep 2024 17:06:58 +0000 X-Fes-Received-For: 73279 <at> debbugs.gnu.org X-Fes-Received-From: <brennan@HIDDEN> From: "Brennan Vincent" <brennan@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve In-Reply-To: <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> Date: Mon, 16 Sep 2024 13:06:55 -0400 Message-ID: <87y13r5xzk.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes: > On Mon, Sep 16, 2024 at 4:50=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora= @gmail.com> wrote: >> >> On Mon, Sep 16, 2024 at 4:40=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavor= a@HIDDEN> wrote: >> > >> > On Mon, Sep 16, 2024 at 4:17=E2=80=AFPM Brennan Vincent <brennan@umanw= izard.com> wrote: >> > >> > > As for the regression: yes, it's a regression from 29.4, and in fact= I >> > > have bisected to the commit that regressed it: >> > > a8c1559a663d9bc21776e33303251e244f86f0d7 >> > >> > Oh alright, that clears it up. It was an oversight indeed, so I think >> > your patch is TRT. I'll install it in emacs-30. >> >> Actually, not so fast. The code before that allegedly broken commit >> _also_ sent outstanding changes to the server before resolving >> (via the advice that was then removed). Not according to my testing. And, taking a look at the old code: (advice-add #'jsonrpc-request :before (cl-function (lambda (_proc _method _params &key deferred &allow-other-keys) (when (and eglot--managed-mode deferred) (eglot--signal-textDocument/didChange)))) '((name . eglot--signal-textDocument/didChange))) It seems that we are only sending the changes if the function is called with the :deferred flag. The function was NOT called with the :deferred flag at the site in question, which as of 093a36 (parent of a8c1559) looked like this: (jsonrpc-request server :completionItem/resolve lsp-comp :cancel-on-input t) >> >> So I must be missing something, and must investigate more >> closely. > > Brennan, can you provide an excerpt of the Eglot event log > (M-x eglot-events-buffer) for your MRE recipe before and > after a8c1559a663d9bc21776e33303251e244f86f0d7? > Sure. See attachments. They are a bit long because of the huge doc strings rust-analyzer includes, but you should get the idea by searching for textDocument/completion. Note that in BEFORE, we send textDocument/completion, immediately followed = by completionItem/resolve. In AFTER, we send textDocument/completion, then textDocument/didChange, then completionItem/resolve. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=BEFORE Content-Transfer-Encoding: quoted-printable Content-Description: Before a8c1559 [internal] Mon Sep 16 12:52:54 2024: (:message "Running language server: rust-analyzer") [client-request] (id:1) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 1 :method "initialize" :params (:processId 1665562 :clientInfo (:name "Eglot") :rootPath "/home/brennan/test_rust/" :rootUri "file:///home/brennan= /test_rust" :initializationOptions #s(hash-table size 1 test eql rehash-siz= e 1.5 rehash-threshold 0.8125 data ()) :capabilities (:workspace (:applyEdit t :executeCommand (:dynamicRegistration :json-false) :workspaceEdit (:documentChanges t) :didChangeWatchedFiles (:dynamicRegistration t) :symbol (:dynamicRegistration :json-false) :configuration t :workspaceFolders t) :textDocument (:synchronization (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didS= ave t) :completion (:dynamicRegistration :json-false :completionItem (:snippetSupport :json-false :deprecatedSupport t :resolveSupport (:properties ["documentation" "details" "additionalTextEdits"]) :tagSupport (:valueSet [1])) :contextSupport t) :hover (:dynamicRegistration :json-false :contentFormat ["plaintext"]) :signatureHelp (:dynamicRegistration :json-false :signatureInformation (:parameterInformation (:labelOffsetSupport t) :activeParameterSupport t)) :references (:dynamicRegistration :json-false) :definition (:dynamicRegistration :json-false :linkSupport t) :declaration (:dynamicRegistration :json-false :linkSupport t) :implementation (:dynamicRegistration :json-false :linkSupport t) :typeDefinition (:dynamicRegistration :json-false :linkSupport t) :documentSymbol (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t := symbolKind (:valueSet [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24= 25 26])) :documentHighlight (:dynamicRegistration :json-false) :codeAction (:dynamicRegistration :json-false :codeActionLiteralSupport (:codeActionKind (:valueSet ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor= .rewrite" "source" "source.organizeImports"])) :isPreferredSupport t) :formatting (:dynamicRegistration :json-false) :rangeFormatting (:dynamicRegistration :json-false) :rename (:dynamicRegistration :json-false) :inlayHint (:dynamicRegistration :json-false) :publishDiagnostics (:relatedInformation :json-false :codeDescriptionSupport :json-false :ta= gSupport (:valueSet [1 2]))) :window (:workDoneProgress t) :general (:positionEncodings ["utf-32" "utf-8" "utf-16"]) :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash= -threshold 0.8125 data ())) :workspaceFolders [(:uri "file:///home/brennan/test_rust" :name "~/test_rust/")])) [server-reply] (id:1) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 1 :result (:capabilities (:positionEncoding "utf-32" :textDocumentSync (:openClose t :change 2 :save nil) :selectionRangeProvider t :hoverProvider t :completionProvider (:resolveProvider t :triggerCharacters [":" "." "'" "("] :completionItem (:labelDetailsSupport :json-false)) :signatureHelpProvider (:triggerCharacters ["(" "," "<"]) :definitionProvider t :typeDefinitionProvider t :implementationPro= vider t :referencesProvider t :documentHighlightProvider t :documentSymbolP= rovider t :workspaceSymbolProvider t :codeActionProvider (:codeActionKinds ["" "quickfix" "refactor" "refactor.extract" "refactor.inline" "r= efactor.rewrite"] :resolveProvider t) :codeLensProvider (:resolveProvider t) :documentFormattingProvider t :documentRangeFormattingProvider :js= on-false :documentOnTypeFormattingProvider (:firstTriggerCharacter "=3D" :moreTriggerCharacter ["." ">" "{" "("]) :renameProvider (:prepareProvider t) :foldingRangeProvider t :declarationProvider t :workspace (:workspaceFolders (:supported t :changeNotifications t) :fileOperations (:willRename (:filters [(:scheme "file" :pattern (:glob "**/*.rs" :matches "file")) (:scheme "file" :pattern (:glob "**" :matches "folder"))]))) :callHierarchyProvider t :semanticTokensProvider (:legend (:tokenTypes ["comment" "decorator" "enumMember" "enum" "function" "interface" "keyw= ord" "macro" "method" "namespace" "number" "operator" "parameter" "property= " "string" "struct" "typeParameter" "variable" "angle" "arithmetic" "attrib= uteBracket" "attribute" "bitwise" "boolean" "brace" "bracket" "builtinAttri= bute" "builtinType" "character" "colon" "comma" "comparison" "constParamete= r" "const" "deriveHelper" "derive" "dot" "escapeSequence" "formatSpecifier"= "generic" "invalidEscapeSequence" "label" "lifetime" "logical" "macroBang"= "parenthesis" "procMacro" "punctuation" "selfKeyword" "selfTypeKeyword" "s= emicolon" "static" "toolModule" "typeAlias" "union" "unresolvedReference"] :tokenModifiers ["async" "documentation" "declaration" "static" "defaultLibrary" "assoc= iated" "attribute" "callable" "constant" "consuming" "controlFlow" "crateRo= ot" "injected" "intraDocLink" "library" "macro" "mutable" "procMacro" "publ= ic" "reference" "trait" "unsafe"]) :range t :full (:delta t)) :inlayHintProvider (:resolveProvider t) :experimental (:externalDocs t :hoverRange t :joinLines t :matchingBrace t :move= Item t :onEnter t :openCargoToml t :parentModule t :runnables (:kinds ["cargo"]) :ssr t :workspaceSymbolScopeKindFiltering t)) :serverInfo (:name "rust-analyzer" :version "1.81.0 (eeb90cda 2024-09-04)"))) [client-notification] Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql= rehash-size 1.5 rehash-threshold 0.8125 data ())) [client-notification] Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :method "textDocument/didOpen" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs" :version 0 :language= Id "rust-ts" :text "struct S<T> {\n x: T\n}\n\nimpl<T> S<HashSet<T>> {\n= }\n\nfn main() {}\n"))) [client-notification] Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshol= d 0.8125 data ()))) [client-request] (id:2) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 2 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :range (:start (:line 0 :character 0) :end (:line 8 :character 0)))) [server-request] (id:0) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 0 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:0) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 0 :result nil) [server-notification] Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-request] (id:1) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params (:items [(:section "rust-analyzer")])) [client-reply] (id:1) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 1 :result [nil]) [server-reply] (id:2) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 2 :result []) [server-notification] Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-request] (id:2) Mon Sep 16 12:52:54 2024: (:jsonrpc "2.0" :id 2 :method "client/registerCapability" :params (:registrations [(:id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWat= chedFiles" :registerOptions (:watchers [(:globPattern "/home/brennan/test_rust/**/*.rs") (:globPattern "/home/brennan/test_rust/**/Cargo.{toml,lock}") (:globPattern "/home/brennan/test_rust/**/rust-analyzer.toml") (:globPattern "/home/brennan/.config/rust-analyzer/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/Cargo.toml")]))])) [client-reply] (id:2) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 2 :result nil) [server-request] (id:3) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 3 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:3) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 3 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:4) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 4 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Roots Scanned")) [client-reply] (id:4) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 4 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "begin" :title "Roots Scanned" :cancellable :json-false :message= "0/3" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/alloc" :percentage 0))) [server-request] (id:5) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 5 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:5) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 5 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/core" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/backtrace" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_abort" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_unwind" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/portable-simd" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/proc_macro" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/profiler_builtins" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rtstartup" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-alloc" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-core" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-std" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/std" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/stdarch" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/sysroot" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/test" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/unwind" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3" :percentage 33)= )) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: src" :percentag= e 33))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "2/3" :percentage 66)= )) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "end" :message "3/3"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:6) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 6 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:6) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 6 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-request] (id:7) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 7 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:7) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 7 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [] :version 0)) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "0/1 (test_rust)" :pe= rcentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:8) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 8 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:8) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 8 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-request] (id:9) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 9 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:9) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 9 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:10) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 10 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building build-artifacts")) [client-reply] (id:10) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 10 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "begin" :title "Building build-artifacts" :cancellable :json-fal= se))) [server-request] (id:11) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 11 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:11) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 11 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-request] (id:12) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 12 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Loading proc-macros")) [client-reply] (id:12) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 12 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "begin" :title "Loading proc-macros" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "5/12 (core + 2 more)= " :percentage 41))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:13) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 13 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:13) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 13 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "5/12 (core + 2 more)= " :percentage 41))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "6/12 (core + 1 more)= " :percentage 50))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "7/12 (core)" :percen= tage 58))) [server-request] (id:14) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 14 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:14) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 14 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [client-request] (id:3) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 3 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [client-request] (id:4) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 4 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [client-request] (id:5) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 5 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "report" :cancellable :json-false :message "building proc-macros= : test_rust"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "report" :cancellable :json-false :message "building proc-macros= : test_rust"))) [server-request] (id:15) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 15 :method "client/registerCapability" :params (:registrations [(:id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWat= chedFiles" :registerOptions (:watchers [(:globPattern "/home/brennan/test_rust/**/*.rs") (:globPattern "/home/brennan/test_rust/**/Cargo.{toml,lock}") (:globPattern "/home/brennan/test_rust/**/rust-analyzer.toml") (:globPattern "/home/brennan/.config/rust-analyzer/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/Cargo.toml")]))])) [client-reply] (id:15) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 15 :result nil) [server-request] (id:16) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 16 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:16) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 16 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "end"))) [server-reply] (id:3) ERROR Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 3 :error (:code -32801 :message "content modified")) [internal] (id:3) ERROR Mon Sep 16 12:52:55 2024: (:message "error ignored, status set (content modified)" :id 3 :error -3280= 1) [server-reply] (id:4) ERROR Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 4 :error (:code -32801 :message "content modified")) [internal] (id:4) ERROR Mon Sep 16 12:52:55 2024: (:message "error ignored, status set (content modified)" :id 4 :error -3280= 1) [server-reply] (id:5) ERROR Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 5 :error (:code -32801 :message "content modified")) [internal] (id:5) ERROR Mon Sep 16 12:52:55 2024: (:message "error ignored, status set (content modified)" :id 5 :error -3280= 1) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:17) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 17 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Roots Scanned")) [client-reply] (id:17) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 17 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "begin" :title "Roots Scanned" :cancellable :json-false :message= "0/3" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/alloc" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/core" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/backtrace" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_abort" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_unwind" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/portable-simd" :percentage 0))) [server-request] (id:18) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 18 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Loading proc-macros")) [client-reply] (id:18) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 18 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "begin" :title "Loading proc-macros" :cancellable :json-false))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "end"))) [server-request] (id:19) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 19 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:19) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 19 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "4/12 (core + 3 more)= " :percentage 33))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/proc_macro" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/profiler_builtins" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rtstartup" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-alloc" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-core" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-std" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/std" :percentage 0))) [server-request] (id:20) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 20 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:20) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 20 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "5/12 (core + 2 more)= " :percentage 41))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "6/12 (core + 1 more)= " :percentage 50))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/stdarch" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "7/12 (core)" :percen= tage 58))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/sysroot" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/test" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/unwind" :percentage 0))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3" :percentage 33)= )) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: src" :percentag= e 33))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "2/3" :percentage 66)= )) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "end" :message "3/3"))) [server-request] (id:21) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 21 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:21) Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :id 21 :result nil) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:52:55 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 66))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "8/12 (alloc)" :perce= ntage 66))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 75))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "9/12 (std)" :percent= age 75))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 83))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "10/12 (proc_macro)" = :percentage 83))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 91))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "11/12 (test_rust)" := percentage 91))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:22) Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :id 22 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:22) Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :id 22 :result nil) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 66))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 75))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 83))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 91))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "11/12 (test_rust)" := percentage 91))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:52:56 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [client-request] (id:6) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 6 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 23))) [client-request] (id:7) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 7 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 23))) [client-request] (id:8) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 8 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 23))) [server-reply] (id:6) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 6 :result nil) [server-reply] (id:7) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 7 :result nil) [server-reply] (id:8) Mon Sep 16 12:52:57 2024: (:jsonrpc "2.0" :id 8 :result nil) [client-request] (id:9) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 9 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:10) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 10 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:11) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 11 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [server-reply] (id:9) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 9 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:10) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 10 :result nil) [server-reply] (id:11) Mon Sep 16 12:52:58 2024: (:jsonrpc "2.0" :id 11 :result nil) [client-request] (id:12) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 12 :method "textDocument/completion" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17) :context (:triggerKind 1))) [server-reply] (id:12) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 12 :result (:isIncomplete t :items [(:label "HashSet (use std::collections::HashSet)" :kind 22 :detail "Ha= shSet<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` whe= re the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires= that the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freq= uently be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you imple= ment these yourself,\nit is important that the following property holds:\n\= n```text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, = if two keys are equal, their hashes must be equal.\nViolating this property= is a logic error.\n\nIt is also a logic error for a key to be modified in = such a way that the key's\nhash, as determined by the [`Hash`] trait, or it= s equality, as determined by\nthe [`Eq`] trait, changes while it is in the = map. This is normally only\npossible through [`Cell`], [`RefCell`], global = state, I/O, or unsafe code.\n\nThe behavior resulting from either logic err= or is not specified, but will\nbe encapsulated to the `HashSet` that observ= ed the logic error and not\nresult in undefined behavior. This could includ= e panics, incorrect results,\naborts, memory leaks, and non-termination.\n\= n# Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference l= ets us omit an explicit type signature (which\n// would be `HashSet<String>= ` in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books= .\nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To K= ill a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string()= );\nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a speci= fic one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We = have {} books, but The Winds of Winter ain't one.\",\n books.le= n());\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate= over everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\= n\nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`]= and [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`E= q`] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, = Eq, PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usiz= e,\n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { nam= e: \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Ein= ar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_s= tring(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string()= , power: 8 });\n\n// Use derived implementation to print the vikings.\nfor = x in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a kno= wn list of items can be initialized from an array:\n\n```rust\nuse std::col= lections::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf= \", \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-varian= t-of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`Re= fCell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :t= extEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [] :data (:position (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17)) :imports [(:full_import_path "std::collections::HashSet" :imported_name "Hash= Set")] :version 0)) (:label "self::" :kind 14 :deprecated :json-false :preselect t :sortTe= xt "ffffffef" :filterText "self::" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "self::") :additionalTextEdits []) (:label "crate::" :kind 14 :deprecated :json-false :preselect t :sortT= ext "ffffffef" :filterText "crate::" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "crate::") :additionalTextEdits []) (:label "Self" :kind 12 :detail "S<{unknown}>" :deprecated :json-false= :preselect t :sortText "ffffffef" :filterText "Self" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Self") :additionalTextEdits []) (:label "T" :kind 25 :deprecated :json-false :preselect t :sortText "f= fffffef" :filterText "T" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "T") :additionalTextEdits []) (:label "S" :kind 22 :detail "S<{unknown}>" :deprecated :json-false :p= reselect t :sortText "ffffffef" :filterText "S" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "S") :additionalTextEdits []) (:label "panic!" :kind 3 :detail "macro_rules! panic" :deprecated :jso= n-false :preselect t :sortText "ffffffef" :filterText "panic!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "panic!") :additionalTextEdits []) (:label "println!" :kind 3 :detail "macro_rules! println" :documentati= on (:kind "markdown" :value "Prints to the standard output, with a newli= ne.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+0= 00A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macr= o uses the same syntax as [`format!`], but writes to the standard output in= stead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will= lock the standard output on each call. If you call\n`println!` within a ho= t loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lo= ck stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdou= t, Write};\n\nlet mut lock =3D stdout().lock();\nwriteln!(lock, \"hello wor= ld\").unwrap();\n```\n\nUse `println!` only for the primary output of your = program. Use\n[`eprintln!`] instead to print error and progress messages.\n= \nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\n= for details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`ep= rintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics= if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can = cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: cr= ate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newl= ine\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\= ");\nlet local_variable =3D \"some\";\nprintln!(\"format {local_variable} a= rguments\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "println!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "println!") :additionalTextEdits []) (:label "debug_assert_eq!" :kind 3 :detail "macro_rules! debug_assert_= eq" :documentation (:kind "markdown" :value "Asserts that two expressions are equal to e= ach other.\n\nOn panic, this macro will print the values of the expressions= with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert= _eq!` statements are only enabled in non\noptimized builds by default. An o= ptimized build will not execute\n`debug_assert_eq!` statements unless `-C d= ebug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` = useful for checks that are too\nexpensive to be present in a release build = but may be helpful during\ndevelopment. The result of expanding `debug_asse= rt_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet= b =3D 1 + 2;\ndebug_assert_eq!(a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert_eq!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert_eq!") :additionalTextEdits []) (:label "include_str!" :kind 3 :detail "macro_rules! include_str" :doc= umentation (:kind "markdown" :value "Includes a UTF-8 encoded file as a string.\= n\nThe file is located relative to the current file (similarly to how\nmodu= les are found). The provided path is interpreted in a platform-specific\nwa= y at compile time. So, for instance, an invocation with a Windows path\ncon= taining backslashes `\\` would not compile correctly on Unix.\n\nThis macro= will yield an expression of type `&'static str` which is the\ncontents of = the file.\n\n# Examples\n\nAssume there are two files in the same directory= with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadi=C3=B3s= \n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str =3D includ= e_str!(\"spanish.in\");\n assert_eq!(my_str, \"adi=C3=B3s\\n\");\n pr= int!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resultin= g binary will print \"adi=C3=B3s\".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include_str!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include_str!") :additionalTextEdits []) (:label "concat!" :kind 3 :detail "macro_rules! concat" :documentation (:kind "markdown" :value "Concatenates literals into a static string = slice.\n\nThis macro takes any number of comma-separated literals, yielding= an\nexpression of type `&'static str` which represents all of the literals= \nconcatenated left-to-right.\n\nInteger and floating point literals are [s= tringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\= n```rust\nlet s =3D concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test= 10btrue\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "concat!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "concat!") :additionalTextEdits []) (:label "format!" :kind 3 :detail "macro_rules! format" :documentation (:kind "markdown" :value "Creates a `String` using interpolation of r= untime expressions.\n\nThe first argument `format!` receives is a format st= ring. This must be a string\nliteral. The power of the formatting string is= in the `{}`s contained.\nAdditional parameters passed to `format!` replace= the `{}`s within the\nformatting string in the order given unless named or= positional parameters\nare used.\n\nSee [the formatting syntax documentati= on in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for = `format!` is concatenation and interpolation of strings.\nThe same conventi= on is used with [`print!`] and [`write!`] macros,\ndepending on the intende= d destination of the string; all these macros internally use [`format_args!= `].\n\nTo convert a single value to a string, use the [`to_string`] method.= This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literal= s into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/m= acro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_ar= gs\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display= \n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting= trait implementation returns an error.\nThis indicates an incorrect implem= entation\nsince `fmt::Write for String` never returns an error itself.\n\n#= Examples\n\n```rust\nformat!(\"test\"); // =3D= > \"test\"\nformat!(\"hello {}\", \"world!\"); // =3D> \"hell= o world!\"\nformat!(\"x =3D {}, y =3D {val}\", 10, val =3D 30); // =3D> \"= x =3D 10, y =3D 30\"\nlet (x, y) =3D (1, 2);\nformat!(\"{x} + {y} =3D 3\");= // =3D> \"1 + 2 =3D 3\"\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "format!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "format!") :additionalTextEdits []) (:label "stringify!" :kind 3 :detail "macro_rules! stringify" :documen= tation (:kind "markdown" :value "Stringifies its arguments.\n\nThis macro wi= ll yield an expression of type `&'static str` which is the\nstringification= of all the tokens passed to the macro. No restrictions\nare placed on the = syntax of the macro invocation itself.\n\nNote that the expanded results of= the input tokens may change in the\nfuture. You should be careful if you r= ely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one =3D stringify= !(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "stringify!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "stringify!") :additionalTextEdits []) (:label "assert_ne!" :kind 3 :detail "macro_rules! assert_ne" :documen= tation (:kind "markdown" :value "Asserts that two expressions are not equal = to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the= values of the expressions with their\ndebug representations.\n\nLike [`ass= ert!`], this macro has a second form, where a custom\npanic message can be = provided.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet b =3D 2;\nassert_ne!(= a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\"= );\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert_ne!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert_ne!") :additionalTextEdits []) (:label "dbg!" :kind 3 :detail "macro_rules! dbg" :documentation (:kind "markdown" :value "Prints and returns the value of a given exp= ression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = =3D 2;\nlet b =3D dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2:9] a= * 2 =3D 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` = implementation of the type of\nthe given expression to print the value to [= stderr] along with the\nsource location of the macro invocation as well as = the source code\nof the expression.\n\nInvoking the macro on an expression = moves and takes ownership of it\nbefore returning the evaluated expression = unchanged. If the type\nof the expression does not implement `Copy` and you= don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)= `\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same i= n release builds.\nThis is useful when debugging issues that only occur in = release\nbuilds or when debugging in release mode is significantly faster.\= n\nNote that the macro is intended as a debugging tool and therefore you\ns= hould avoid having uses of it in version control for long periods\n(other t= han in tests and similar).\nDebug output from production code is better don= e with other facilities\nsuch as the [`debug!`] macro from the [`log`] crat= e.\n\n# Stability\n\nThe exact output printed by this macro should not be r= elied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writ= ing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n= ```rust\nfn foo(n: usize) {\n if let Some(_) =3D dbg!(n.checked_sub(4)) = {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n`= ``text,ignore\n[src/main.rs:2:22] n.checked_sub(4) =3D None\n```\n\nNaive f= actorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if = dbg!(n <=3D 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial= (n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\= n\n```text,ignore\n[src/main.rs:2:8] n <=3D 1 =3D false\n[src/main.rs:2:8] = n <=3D 1 =3D false\n[src/main.rs:2:8] n <=3D 1 =3D false\n[src/main.rs:2:8]= n <=3D 1 =3D true\n[src/main.rs:3:9] 1 =3D 1\n[src/main.rs:7:9] n * factor= ial(n - 1) =3D 2\n[src/main.rs:7:9] n * factorial(n - 1) =3D 6\n[src/main.r= s:7:9] n * factorial(n - 1) =3D 24\n[src/main.rs:9:1] factorial(4) =3D 24\n= ```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper arou= nd `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoC= opy(usize);\n\nlet a =3D NoCopy(42);\nlet _ =3D dbg!(a); // <-- `a` is move= d here.\nlet _ =3D dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou c= an also use `dbg!()` without a value to just print the\nfile and line whene= ver it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it= will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(d= bg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trail= ing comma will still not be treated\nas a tuple, following the convention o= f ignoring trailing commas in macro\ninvocations. You can use a 1-tuple dir= ectly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing = comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]= : https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[= `debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://cra= tes.io/crates/log") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "dbg!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "dbg!") :additionalTextEdits []) (:label "vec!" :kind 3 :detail "macro_rules! vec" :documentation (:kind "markdown" :value "Creates a [`Vec`] containing the arguments.= \n\n`vec!` allows `Vec`s to be defined with the same syntax as array expres= sions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing= a given list of elements:\n\n```rust\nlet v =3D vec![1, 2, 3];\nassert_eq!= (v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [= `Vec`] from a given element and size:\n\n```rust\nlet v =3D vec![1; 3];\nas= sert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syn= tax supports all elements\nwhich implement [`Clone`] and the number of elem= ents doesn't have to be\na constant.\n\nThis will use `clone` to duplicate = an expression, so one should be careful\nusing this with types having a non= standard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will c= reate a vector of five references\nto the same boxed integer value, not fiv= e references pointing to independently\nboxed integers.\n\nAlso, note that = `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still = evaluate `expr`, however, and immediately drop the resulting value, so\nbe = mindful of side effects.\n\n[`Vec`]: crate::vec::Vec") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "vec!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "vec!") :additionalTextEdits []) (:label "include!" :kind 3 :detail "macro_rules! include" :documentati= on (:kind "markdown" :value "Parses a file as an expression or an item a= ccording to the context.\n\n**Warning**: For multi-file Rust projects, the = `include!` macro is probably not what you\nare looking for. Usually, multi-= file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items= /modules.html). Multi-file projects and\nmodules are explained in the Rust-= by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split= .html) and the module system is\nexplained in the Rust Book\n[here](https:/= /doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-priva= cy.html).\n\nThe included file is placed in the surrounding code\n[unhygien= ically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene)= . If\nthe included file is parsed as an expression and variables or functio= ns share names across\nboth files, it could result in variables or function= s being different from what the\nincluded file expected.\n\nThe included fi= le is located relative to the current file (similarly to how modules are\nf= ound). The provided path is interpreted in a platform-specific way at compi= le time. So,\nfor instance, an invocation with a Windows path containing ba= ckslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `incl= ude!` macro is primarily used for two purposes. It is used to include\ndocu= mentation that is written in a separate file and it is used to include [bui= ld artifacts\nusually as a result from the `build.rs`\nscript](https://doc.= rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-scrip= t).\n\nWhen using the `include` macro to include stretches of documentation= , remember that the\nincluded file still needs to be a valid Rust syntax. I= t is also possible to\nuse the [`include_str`] macro as `#![doc =3D include= _str!(\"...\")]` (at the module level) or\n`#[doc =3D include_str!(\"...\")= ]` (at the item level) to include documentation from a plain\ntext or markd= own file.\n\n# Examples\n\nAssume there are two files in the same directory= with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['=F0=9F=99= =88', '=F0=9F=99=8A', '=F0=9F=99=89']\n .iter()\n .cycle()\n .take= (6)\n .collect::<String>()\n```\n\nFile 'main.rs':\n\n```rust\nfn main()= {\n let my_string =3D include!(\"monkeys.in\");\n assert_eq!(\"=F0= =9F=99=88=F0=9F=99=8A=F0=9F=99=89=F0=9F=99=88=F0=9F=99=8A=F0=9F=99=89\", my= _string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' an= d running the resulting binary will print\n\"=F0=9F=99=88=F0=9F=99=8A=F0=9F= =99=89=F0=9F=99=88=F0=9F=99=8A=F0=9F=99=89\".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include!") :additionalTextEdits []) (:label "print!" :kind 3 :detail "macro_rules! print" :documentation (:kind "markdown" :value "Prints to the standard output.\n\nEquivalen= t to the [`println!`] macro except that a newline is not printed at\nthe en= d of the message.\n\nNote that stdout is frequently line-buffered by defaul= t so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure = the output is emitted\nimmediately.\n\nThe `print!` macro will lock the sta= ndard output on each call. If you call\n`print!` within a hot loop, this be= havior may be the bottleneck of the loop.\nTo avoid this, lock stdout with = [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nl= et mut lock =3D stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n= ```\n\nUse `print!` only for the primary output of your program. Use\n[`epr= int!`] instead to print error and progress messages.\n\nSee [the formatting= documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the ma= cro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: cra= te::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Pan= ics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blockin= g stdout can cause an error, which will lead\nthis macro to panic.\n\n# Exa= mples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!= (\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!= (\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint= !(\"this string has a newline, why not choose println! instead?\\n\");\n\ni= o::stdout().flush().unwrap();\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "print!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "print!") :additionalTextEdits []) (:label "write!" :kind 3 :detail "macro_rules! write" :documentation (:kind "markdown" :value "Writes formatted data into a buffer.\n\nThi= s macro accepts a 'writer', a format string, and a list of arguments. Argum= ents will be\nformatted according to the specified format string and the re= sult will be passed to the writer.\nThe writer may be any value with a `wri= te_fmt` method; generally this comes from an\nimplementation of either the = [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the = `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result= `].\n\nSee [`std::fmt`] for more information on the format string syntax.\n= \n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[= `io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Resu= lt\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nus= e std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w =3D = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted= {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");= \n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std= ::io::Write` and call `write!` on objects\nimplementing either, as objects = do not typically implement both. However, the module must\navoid conflict b= etween the trait names, such as by importing them as `_` or otherwise renam= ing\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\= n\nfn main() -> Result<(), Box<dyn std::error::Error>> {\n let mut s =3D= String::new();\n let mut v =3D Vec::new();\n\n write!(&mut s, \"{} {= }\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = =3D {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s =3D \= \\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names = themselves, such as to implement one or both on your types,\nimport the con= taining module and then name them with a prefix:\n\n```rust\nuse std::fmt::= {self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\= nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> co= re::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This = macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are = responsible for the implementation details of the components.\n\n```rust\nu= se core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn= write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemen= ted!();\n }\n}\n\nlet mut m =3D Example{};\nwrite!(&mut m, \"Hello World= \").expect(\"Not written\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "write!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "write!") :additionalTextEdits []) (:label "line!" :kind 3 :detail "macro_rules! line" :documentation (:kind "markdown" :value "Expands to the line number on which it was = invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging = information for\ndevelopers about the location within the source.\n\nThe ex= panded expression has type `u32` and is 1-based, so the first line\nin each= file evaluates to 1, the second to 2, etc. This is consistent\nwith error = messages by common compilers or popular editors.\nThe returned line is *not= necessarily* the line of the `line!` invocation itself,\nbut rather the fi= rst macro invocation leading up to the invocation\nof the `line!` macro.\n\= n# Examples\n\n```rust\nlet current_line =3D line!();\nprintln!(\"defined o= n line: {current_line}\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "line!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "line!") :additionalTextEdits []) (:label "debug_assert!" :kind 3 :detail "macro_rules! debug_assert" :d= ocumentation (:kind "markdown" :value "Asserts that a boolean expression is `true`= at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expre= ssion cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this = macro also has a second version, where a custom panic\nmessage can be provi= ded.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only e= nabled in non\noptimized builds by default. An optimized build will not exe= cute\n`debug_assert!` statements unless `-C debug-assertions` is passed to = the\ncompiler. This makes `debug_assert!` useful for checks that are too\ne= xpensive to be present in a release build but may be helpful during\ndevelo= pment. The result of expanding `debug_assert!` is always type checked.\n\nA= n unchecked assertion allows a program in an inconsistent state to keep\nru= nning, which might have unexpected consequences but does not introduce\nuns= afety as long as this only happens in safe code. The performance cost\nof a= ssertions, however, is not measurable in general. Replacing [`assert!`]\nwi= th `debug_assert!` is thus only encouraged after thorough profiling, and\nm= ore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic = message for these assertions is the stringified value of the\n// expression= given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { = true } // a very simple function\ndebug_assert!(some_expensive_computation(= ));\n\n// assert with a custom message\nlet x =3D true;\ndebug_assert!(x, \= "x wasn't true!\");\n\nlet a =3D 3; let b =3D 27;\ndebug_assert!(a + b =3D= =3D 30, \"a =3D {}, b =3D {}\", a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert!") :additionalTextEdits []) (:label "include_bytes!" :kind 3 :detail "macro_rules! include_bytes" = :documentation (:kind "markdown" :value "Includes a file as a reference to a byte ar= ray.\n\nThe file is located relative to the current file (similarly to how\= nmodules are found). The provided path is interpreted in a platform-specifi= c\nway at compile time. So, for instance, an invocation with a Windows path= \ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis = macro will yield an expression of type `&'static [u8; N]` which is\nthe con= tents of the file.\n\n# Examples\n\nAssume there are two files in the same = directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\na= di=C3=B3s\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = =3D include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3= s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCo= mpiling 'main.rs' and running the resulting binary will print \"adi=C3=B3s\= ".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include_bytes!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include_bytes!") :additionalTextEdits []) (:label "env!" :kind 3 :detail "macro_rules! env" :documentation (:kind "markdown" :value "Inspects an environment variable at compile= time.\n\nThis macro will expand to the value of the named environment vari= able at\ncompile time, yielding an expression of type `&'static str`. Use\n= [`std::env::var`] instead if you want to read the value at runtime.\n\n[`st= d::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not= defined, then a compilation error\nwill be emitted. To not emit a compile = error, use the [`option_env!`]\nmacro instead. A compilation error will als= o be emitted if the\nenvironment variable is not a vaild Unicode string.\n\= n# Examples\n\n```rust\nlet path: &'static str =3D env!(\"PATH\");\nprintln= !(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou= can customize the error message by passing a string as the second\nparamet= er:\n\n```rust\nlet doc: &'static str =3D env!(\"documentation\", \"what's = that?!\");\n```\n\nIf the `documentation` environment variable is not defin= ed, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "env!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "env!") :additionalTextEdits []) (:label "try!" :kind 3 :detail "macro_rules! r#try" :documentation (:kind "markdown" :value "Unwraps a result or propagates its error.\n= \nThe [`?` operator][propagating-errors] was added to replace `try!`\nand s= hould be used instead. Furthermore, `try` is a reserved word\nin Rust 2018,= so if you must use it, you will need to use the\n[raw-identifier syntax][r= is]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-= 02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-th= e--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compa= tibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In ca= se of the `Ok` variant, the\nexpression has the value of the wrapped value.= \n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then= \nperforms conversion using `From`. This provides automatic conversion\nbet= ween specialized errors and more general ones. The resulting\nerror is then= immediately returned.\n\nBecause of the early return, `try!` can only be u= sed in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std= ::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n = FileWriteError\n}\n\nimpl From<io::Error> for MyError {\n fn from(e: io:= :Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The p= referred method of quick returning Errors\nfn write_to_file_question() -> R= esult<(), MyError> {\n let mut file =3D File::create(\"my_best_friends.t= xt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n = Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to= _file_using_try() -> Result<(), MyError> {\n let mut file =3D r#try!(Fil= e::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is = a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:= \nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file= =3D r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_a= ll(b\"This is a list of my best friends.\") {\n Ok(v) =3D> v,\n = Err(e) =3D> return Err(From::from(e)),\n }\n Ok(())\n}\n```") :deprecated t :preselect t :sortText "ffffffef" :filterText "try!" :t= extEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "r#try!") :additionalTextEdits [] :tags [1]) (:label "file!" :kind 3 :detail "macro_rules! file" :documentation (:kind "markdown" :value "Expands to the file name in which it was in= voked.\n\nWith [`line!`] and [`column!`], these macros provide debugging in= formation for\ndevelopers about the location within the source.\n\nThe expa= nded expression has type `&'static str`, and the returned file\nis not the = invocation of the `file!` macro itself, but rather the\nfirst macro invocat= ion leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n``= `rust\nlet this_file =3D file!();\nprintln!(\"defined in file: {this_file}\= ");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "file!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "file!") :additionalTextEdits []) (:label "thread_local!" :kind 3 :detail "macro_rules! thread_local" :d= ocumentation (:kind "markdown" :value "Declare a new thread local storage key of t= ype [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of= static declarations and makes them thread local.\nPublicity and attributes= for each static are allowed. Example:\n\n```rust\nuse std::cell::{Cell, Re= fCell};\n\nthread_local! {\n pub static FOO: Cell<u32> =3D Cell::new(1);= \n\n static BAR: RefCell<Vec<f32>> =3D RefCell::new(vec![1.0, 2.0]);\n}\= n\nassert_eq!(FOO.get(), 1);\nBAR.with_borrow(|v| assert_eq!(v[1], 2.0));\n= ```\n\nNote that only shared references (`&T`) to the inner data may be obt= ained, so a\ntype such as [`Cell`] or [`RefCell`] is typically used to allo= w mutating access.\n\nThis macro supports a special `const {}` syntax that = can be used\nwhen the initialization expression can be evaluated as a const= ant.\nThis can enable a more efficient thread local implementation that\nca= n avoid lazy initialization. For types that do not\n[need to be dropped][cr= ate::mem::needs_drop], this can enable an\neven more efficient implementati= on that does not need to\ntrack any additional state.\n\n```rust\nuse std::= cell::RefCell;\n\nthread_local! {\n pub static FOO: RefCell<Vec<u32>> = =3D const { RefCell::new(Vec::new()) };\n}\n\nFOO.with_borrow(|v| assert_eq= !(v.len(), 0));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalK= ey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::Lo= calKey") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "thread_local!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "thread_local!") :additionalTextEdits []) (:label "assert!" :kind 3 :detail "macro_rules! assert" :documentation (:kind "markdown" :value "Asserts that a boolean expression is `true`= at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expre= ssion cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions ar= e always checked in both debug and release builds, and cannot\nbe disabled.= See [`debug_assert!`] for assertions that are not enabled in\nrelease buil= ds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time inv= ariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `a= ssert!` include testing and enforcing run-time\ninvariants in safe code (wh= ose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macr= o has a second form, where a custom panic message can\nbe provided with or = without arguments for formatting. See [`std::fmt`]\nfor syntax for this for= m. Expressions used as format arguments will only\nbe evaluated if the asse= rtion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rus= t\n// the panic message for these assertions is the stringified value of th= e\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { = true } // a very simple function\n\nassert!(some_computation());\n\n// asse= rt with a custom message\nlet x =3D true;\nassert!(x, \"x wasn't true!\");\= n\nlet a =3D 3; let b =3D 27;\nassert!(a + b =3D=3D 30, \"a =3D {}, b =3D {= }\", a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert!") :additionalTextEdits []) (:label "column!" :kind 3 :detail "macro_rules! column" :documentation (:kind "markdown" :value "Expands to the column number at which it wa= s invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging = information for\ndevelopers about the location within the source.\n\nThe ex= panded expression has type `u32` and is 1-based, so the first column\nin ea= ch line evaluates to 1, the second to 2, etc. This is consistent\nwith erro= r messages by common compilers or popular editors.\nThe returned column is = *not necessarily* the line of the `column!` invocation itself,\nbut rather = the first macro invocation leading up to the invocation\nof the `column!` m= acro.\n\n# Examples\n\n```rust\nlet current_col =3D column!();\nprintln!(\"= defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code = points, not bytes or graphemes. As a result, the first two\ninvocations ret= urn the same value, but the third does not.\n\n```rust\nlet a =3D (\"foobar= \", column!()).1;\nlet b =3D (\"=E4=BA=BA=E4=B9=8B=E5=88=9D=E6=80=A7=E6=9C= =AC=E5=96=84\", column!()).1;\nlet c =3D (\"f=CC=85o=CC=85o=CC=85b=CC=85a= =CC=85r=CC=85\", column!()).1; // Uses combining overline (U+0305)\n\nasser= t_eq!(a, b);\nassert_ne!(b, c);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "column!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "column!") :additionalTextEdits []) (:label "unreachable!" :kind 3 :detail "macro_rules! unreachable" :doc= umentation (:kind "markdown" :value "Indicates unreachable code.\n\nThis is usef= ul any time that the compiler can't determine that some code is unreachable= . For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynami= cally terminate.\n* Iterators that dynamically terminate.\n\nIf the determi= nation that the code is unreachable proves incorrect, the\nprogram immediat= ely terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro i= s the [`unreachable_unchecked`] function, which\nwill cause undefined behav= ior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unre= achable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unrea= chable!` is just a shorthand for `panic!` with a\nfixed, specific message.\= n\nLike `panic!`, this macro has a second form for displaying custom values= .\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option<i32>) {\n ma= tch x {\n Some(n) if n >=3D 0 =3D> println!(\"Some(Non-negative)\"),= \n Some(n) if n < 0 =3D> println!(\"Some(Negative)\"),\n Som= e(_) =3D> unreachable!(), // compile error if commented out\n = None =3D> println!(\"None\")\n }\n}\n```\n\nIterators:\= n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest imple= mentations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 ov= erflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\= "The loop should always return\");\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "unreachable!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "unreachable!") :additionalTextEdits []) (:label "eprintln!" :kind 3 :detail "macro_rules! eprintln" :documenta= tion (:kind "markdown" :value "Prints to the standard error, with a newlin= e.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`i= o::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.= \n\nUse `eprintln!` only for error and progress messages. Use `println!`\ni= nstead for the primary output of your program.\n\nSee [the formatting docum= entation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro ar= gument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate:= :io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing = to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error= , which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!= (\"Error: Could not complete task\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "eprintln!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "eprintln!") :additionalTextEdits []) (:label "unimplemented!" :kind 3 :detail "macro_rules! unimplemented" = :documentation (:kind "markdown" :value "Indicates unimplemented code by panicking w= ith a message of \"not implemented\".\n\nThis allows your code to type-chec= k, which is useful if you are prototyping or\nimplementing a trait that req= uires multiple methods which you don't plan to use all of.\n\nThe differenc= e between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an = intent of implementing the functionality later and the message is \"not yet= \nimplemented\", `unimplemented!` makes no such claims. Its message is \"no= t implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis= will always [`panic!`] because `unimplemented!` is just a shorthand for `p= anic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a = second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Ex= amples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&s= elf) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result<u64, ()>;\n}\n= ```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it on= ly makes sense\nto implement the `bar()` function. `baz()` and `qux()` will= still need to be defined\nin our implementation of `Foo`, but we can use `= unimplemented!` in their definitions\nto allow our code to compile.\n\nWe s= till want to have our program stop running if the unimplemented methods are= \nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn = bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n //= It makes no sense to `baz` a `MyStruct`, so we have no logic here\n = // at all.\n // This will display \"thread 'main' panicked at 'not = implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> R= esult<u64, ()> {\n // We have some logic here,\n // We can ad= d a message to unimplemented! to display our omission.\n // This wil= l display:\n // \"thread 'main' panicked at 'not implemented: MyStru= ct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n= }\n}\n\nfn main() {\n let s =3D MyStruct;\n s.bar();\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "unimplemented!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "unimplemented!") :additionalTextEdits []) (:label "cfg!" :kind 3 :detail "macro_rules! cfg" :documentation (:kind "markdown" :value "Evaluates boolean combinations of configura= tion flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this = macro is provided to allow\nboolean expression evaluation of configuration = flags. This frequently\nleads to less duplicated code.\n\nThe syntax given = to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unli= ke `#[cfg]`, does not remove any code and only evaluates to true or false. = For\nexample, all blocks in an if/else expression need to be valid when `cf= g!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\= n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# = Examples\n\n```rust\nlet my_directory =3D if cfg!(windows) {\n \"windows= -specific-directory\"\n} else {\n \"unix-directory\"\n};\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "cfg!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "cfg!") :additionalTextEdits []) (:label "todo!" :kind 3 :detail "macro_rules! todo" :documentation (:kind "markdown" :value "Indicates unfinished code.\n\nThis can be u= seful if you are prototyping and just\nwant a placeholder to let your code = pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!= ` is that while `todo!` conveys\nan intent of implementing the functionalit= y later and the message is \"not yet\nimplemented\", `unimplemented!` makes= no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs wil= l mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!`= is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike = `panic!`, this macro has a second form for displaying custom values.\n\n# E= xamples\n\nHere's an example of some in-progress code. We have a trait `Foo= `:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n = fn qux(&self) -> Result<u64, ()>;\n}\n```\n\nWe want to implement `Foo` = on one of our types, but we also want to work on\njust `bar()` first. In or= der for our code to compile, we need to implement\n`baz()` and `qux()`, so = we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {= \n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n = // Let's not worry about implementing baz() for now\n todo!()= ;\n }\n\n fn qux(&self) -> Result<u64, ()> {\n // We can add a= message to todo! to display our omission.\n // This will display:\n= // \"thread 'main' panicked at 'not yet implemented: MyStruct is no= t yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n= }\n\nfn main() {\n let s =3D MyStruct;\n s.bar();\n\n // We aren't= even using baz() or qux(), so this is fine.\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "todo!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "todo!") :additionalTextEdits []) (:label "module_path!" :kind 3 :detail "macro_rules! module_path" :doc= umentation (:kind "markdown" :value "Expands to a string that represents the cur= rent module path.\n\nThe current module path can be thought of as the hiera= rchy of modules\nleading back up to the crate root. The first component of = the path\nreturned is the name of the crate currently being compiled.\n\n# = Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module= _path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "module_path!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "module_path!") :additionalTextEdits []) (:label "option_env!" :kind 3 :detail "macro_rules! option_env" :docum= entation (:kind "markdown" :value "Optionally inspects an environment variable= at compile time.\n\nIf the named environment variable is present at compil= e time, this will\nexpand into an expression of type `Option<&'static str>`= whose value is\n`Some` of the value of the environment variable. If the en= vironment\nvariable is not present, then this will expand to `None`. See\n[= `Option<T>`][Option] for more information on this type. Use\n[`std::env::v= ar`] instead if you want to read the value at runtime.\n\n[`std::env::var`]= : ../std/env/fn.var.html\n\nA compile time error is never emitted when usin= g this macro regardless\nof whether the environment variable is present or = not.\nTo emit a compile error if the environment variable is not present,\n= use the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&= 'static str> =3D option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key mi= ght be: {key:?}\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "option_env!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "option_env!") :additionalTextEdits []) (:label "writeln!" :kind 3 :detail "macro_rules! writeln" :documentati= on (:kind "markdown" :value "Write formatted data into a buffer, with a = newline appended.\n\nOn all platforms, the newline is the LINE FEED charact= er (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).= \n\nFor more information, see [`write!`]. For information on the format str= ing syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# = Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<(= )> {\n let mut w =3D Vec::new();\n writeln!(&mut w)?;\n writeln!(&= mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;= \n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes())= ;\n Ok(())\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "writeln!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "writeln!") :additionalTextEdits []) (:label "assert_eq!" :kind 3 :detail "macro_rules! assert_eq" :documen= tation (:kind "markdown" :value "Asserts that two expressions are equal to e= ach other (using [`PartialEq`]).\n\nOn panic, this macro will print the val= ues of the expressions with their\ndebug representations.\n\nLike [`assert!= `], this macro has a second form, where a custom\npanic message can be prov= ided.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet b =3D 1 + 2;\nassert_eq!(= a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b= );\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert_eq!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert_eq!") :additionalTextEdits []) (:label "compile_error!" :kind 3 :detail "macro_rules! compile_error" = :documentation (:kind "markdown" :value "Causes compilation to fail with the given e= rror message when encountered.\n\nThis macro should be used when a crate us= es a conditional compilation strategy to provide\nbetter error messages for= erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emi= ts an error during *compilation* rather than at *runtime*.\n\n# Examples\n\= nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better c= ompiler error if a macro is passed invalid values. Without the final branch= ,\nthe compiler would still emit an error, but the error's message would no= t mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_ba= r {\n (foo) =3D> {};\n (bar) =3D> {};\n ($x:ident) =3D> {\n = compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ng= ive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \= "This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if = one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feat= ure =3D \"foo\", feature =3D \"bar\")))]\ncompile_error!(\"Either feature \= \\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "compile_error!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "compile_error!") :additionalTextEdits []) (:label "matches!" :kind 3 :detail "macro_rules! matches" :documentati= on (:kind "markdown" :value "Returns whether the given expression matche= s the provided pattern.\n\nThe pattern syntax is exactly the same as found = in a match arm. The optional if guard can be\nused to add additional checks= that must be true for the matched value, otherwise this macro will\nreturn= `false`.\n\nWhen testing that a value matches a pattern, it's generally pr= eferable to use\n[`assert_matches!`] as it will print the debug representat= ion of the value if the assertion\nfails.\n\n# Examples\n\n```rust\nlet foo= =3D 'f';\nassert!(matches!(foo, 'A'..=3D'Z' | 'a'..=3D'z'));\n\nlet bar = =3D Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "matches!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "matches!") :additionalTextEdits []) (:label "format_args!" :kind 3 :detail "macro_rules! format_args" :doc= umentation (:kind "markdown" :value "Constructs parameters for the other string-= formatting macros.\n\nThis macro functions by taking a formatting string li= teral containing\n`{}` for each additional argument passed. `format_args!` = prepares the\nadditional parameters to ensure the output can be interpreted= as a string\nand canonicalizes the arguments into a single type. Any value= that implements\nthe [`Display`] trait can be passed to `format_args!`, as= can any\n[`Debug`] implementation be passed to a `{:?}` within the formatt= ing string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This= value can be\npassed to the macros within [`std::fmt`] for performing usef= ul redirection.\nAll other formatting macros ([`format!`], [`write!`], [`pr= intln!`], etc) are\nproxied through this one. `format_args!`, unlike its de= rived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments= `] value that `format_args!` returns\nin `Debug` and `Display` contexts as = seen below. The example also shows\nthat `Debug` and `Display` format to th= e same thing: the interpolated\nformat string in `format_args!`.\n\n```rust= \nlet debug =3D format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nle= t display =3D format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert= _eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the f= ormatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details = of the macro argument syntax, and further information.\n\n[`Display`]: crat= e::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::f= mt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/mac= ro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n``= `rust\nuse std::fmt;\n\nlet s =3D fmt::format(format_args!(\"hello {}\", \"= world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```\n\n# Life= time limitation\n\nExcept when no formatting arguments are used,\nthe produ= ced `fmt::Arguments` value borrows temporary values,\nwhich means it can on= ly be used within the same expression\nand cannot be stored for later use.\= nThis is a known limitation, see [#92698](https://github.com/rust-lang/rust= /issues/92698).") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "format_args!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "format_args!") :additionalTextEdits []) (:label "is_x86_feature_detected!" :kind 3 :detail "macro_rules! is_x8= 6_feature_detected" :documentation (:kind "markdown" :value "A macro to test at *runtime* whether a CPU = feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in= the standard library and will detect at runtime\nwhether the specified CPU= feature is detected. This does **not** resolve at\ncompile time unless the= specified feature is already enabled for the entire\ncrate. Runtime detect= ion currently relies mostly on the `cpuid` instruction.\n\nThis macro only = takes one argument which is a string literal of the feature\nbeing tested f= or. The feature names supported are the lowercase versions of\nthe ones def= ined by Intel in [their documentation][docs].\n\n## Supported arguments\n\n= This macro supports the same names that `#[target_feature]` supports. Unlik= e\n`#[target_feature]`, however, this macro does not support names separate= d\nwith a comma. Instead testing for multiple features must be done through= \nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"a= es\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\= "mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.= 1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`= \n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* = `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `= \"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`= \n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"= `\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"avx512fp16\"`\n* `\= "f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\= "`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt= \"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"= rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/= sites/landingpage/IntrinsicsGuide") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "is_x86_feature_detected!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "is_x86_feature_detected!") :additionalTextEdits []) (:label "eprint!" :kind 3 :detail "macro_rules! eprint" :documentation (:kind "markdown" :value "Prints to the standard error.\n\nEquivalent= to the [`print!`] macro, except that output goes to\n[`io::stderr`] instea= d of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` on= ly for error and progress messages. Use `print!`\ninstead for the primary o= utput of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]= : crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../= std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\= n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stde= rr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\= n\n```rust\neprint!(\"Error: Could not complete task\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "eprint!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "eprint!") :additionalTextEdits []) (:label "debug_assert_ne!" :kind 3 :detail "macro_rules! debug_assert_= ne" :documentation (:kind "markdown" :value "Asserts that two expressions are not equal = to each other.\n\nOn panic, this macro will print the values of the express= ions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_as= sert_ne!` statements are only enabled in non\noptimized builds by default. = An optimized build will not execute\n`debug_assert_ne!` statements unless `= -C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_n= e!` useful for checks that are too\nexpensive to be present in a release bu= ild but may be helpful during\ndevelopment. The result of expanding `debug_= assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a =3D 3;\= nlet b =3D 2;\ndebug_assert_ne!(a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert_ne!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert_ne!") :additionalTextEdits []) (:label "std" :kind 9 :documentation (:kind "markdown" :value "# The Rust Standard Library\n\nThe Rust Sta= ndard Library is the foundation of portable Rust software, a\nset of minima= l and battle-tested shared abstractions for the [broader Rust\necosystem][c= rates.io]. It offers core types, like [`Vec<T>`] and\n[`Option<T>`], librar= y-defined [operations on language\nprimitives](#primitives), [standard macr= os](#macros), [I/O] and\n[multithreading], among [many other things][other]= .\n\n`std` is available to all Rust crates by default. Therefore, the\nstan= dard library can be accessed in [`use`] statements through the path\n`std`,= as in [`use std::env`].\n\n# How to read this documentation\n\nIf you alre= ady know the name of what you are looking for, the fastest way to\nfind it = is to use the <a href=3D\"#\" onclick=3D\"window.searchState.focus();\">sea= rch\nbar</a> at the top of the page.\n\nOtherwise, you may want to jump to = one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primiti= ve types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\= n\nIf this is your first time, the documentation for the standard library i= s\nwritten to be casually perused. Clicking on interesting things should\ng= enerally lead you to interesting places. Still, there are important bits\ny= ou don't want to miss, so read on for a tour of the standard library and\ni= ts documentation!\n\nOnce you are familiar with the contents of the standar= d library you may\nbegin to find the verbosity of the prose distracting. At= this stage in your\ndevelopment you may want to press the `[-]` button nea= r the top of the\npage to collapse it into a more skimmable view.\n\nWhile = you are looking at that `[-]` button also notice the `source`\nlink. Rust's= API documentation comes with the source code and you are\nencouraged to re= ad it. The standard library source is generally high\nquality and a peek be= hind the curtains is often enlightening.\n\n# What is in the standard libra= ry documentation?\n\nFirst of all, The Rust Standard Library is divided int= o a number of focused\nmodules, [all listed further down this page](#module= s). These modules are\nthe bedrock upon which all of Rust is forged, and th= ey have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' docume= ntation typically\nincludes an overview of the module along with examples, = and are a smart\nplace to start familiarizing yourself with the library.\n\= nSecond, implicit methods on [primitive types] are documented here. This ca= n\nbe a source of confusion for two reasons:\n\n1. While primitives are imp= lemented by the compiler, the standard library\n implements methods direc= tly on the primitive types (and it is the only\n library that does so), w= hich are [documented in the section on\n primitives](#primitives).\n2. Th= e standard library exports many modules *with the same name as\n primitiv= e types*. These define additional items related to the primitive\n type, = but not the all-important methods.\n\nSo for example there is a [page for t= he primitive type\n`i32`](primitive::i32) that lists all the methods that c= an be called on\n32-bit integers (very useful), and there is a [page for th= e module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`= ] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] an= d [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String= `] and [`Vec<T>`] are actually\ncalls to methods on [`str`] and [`[T]`][pri= m@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, t= he standard library defines [The Rust Prelude], a small collection\nof item= s - mostly traits - that are imported into every module of every\ncrate. Th= e traits in the prelude are pervasive, making the prelude\ndocumentation a = good entry point to learning about the library.\n\nAnd finally, the standar= d library exports a number of standard macros, and\n[lists them on this pag= e](#macros) (technically, not all of the standard\nmacros are defined by th= e standard library - some are defined by the\ncompiler - but they are docum= ented here the same). Like the prelude, the\nstandard macros are imported b= y default into all crates.\n\n# Contributing changes to the documentation\n= \nCheck out the Rust contribution guidelines [here](\nhttps://rustc-dev-gui= de.rust-lang.org/contributing.html#writing-documentation).\nThe source for = this documentation can be found on\n[GitHub](https://github.com/rust-lang/r= ust).\nTo contribute changes, make sure you read the guidelines first, then= submit\npull-requests for your suggested changes.\n\nContributions are app= reciated! If you see a part of the docs that can be\nimproved, submit a PR,= or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of Th= e Rust Standard Library\n\nThe rest of this crate documentation is dedicate= d to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Con= tainers and collections\n\nThe [`option`] and [`result`] modules define opt= ional and error-handling\ntypes, [`Option<T>`] and [`Result<T, E>`]. The [`= iter`] module defines\nRust's iterator trait, [`Iterator`], which works wit= h the [`for`] loop to\naccess collections.\n\nThe standard library exposes = three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec<T>= `] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][= prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]= `][prim@slice] - A dynamically sized *slice* into any other kind of contigu= ous\n storage, whether heap-allocated or not.\n\nSlices can only be handle= d through some kind of *pointer*, and as such come\nin many flavors such as= :\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]= >`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a pri= mitive type, and the standard library\ndefines many methods for it. Rust [`= str`]s are typically accessed as\nimmutable references: `&str`. Use the own= ed [`String`] for building and\nmutating strings.\n\nFor converting to stri= ngs use the [`format!`] macro, and for converting from\nstrings use the [`F= romStr`] trait.\n\nData may be shared by placing it in a reference-counted = box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCel= l`], may be mutated\nas well as shared. Likewise, in a concurrent setting i= t is common to pair an\natomically-reference-counted box, [`Arc`], with a [= `Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines map= s, sets, linked lists and other\ntypical collection types, including the co= mmon [`HashMap<K, V>`].\n\n## Platform abstractions and I/O\n\nBesides basi= c data types, the standard library is largely concerned with\nabstracting o= ver differences in common platforms, most notably Windows and\nUnix derivat= ives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defi= ned in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module c= ontains Rust's threading abstractions. [`sync`]\ncontains further primitive= shared memory types, including [`atomic`] and\n[`mpsc`], which contains th= e channel types for message passing.\n\n# Use before and after `main()`\n\n= Many parts of the standard library are expected to work before and after `m= ain()`;\nbut this is not guaranteed or ensured by tests. It is recommended = that you write your own tests\nand run them on each platform you wish to su= pport.\nThis means that use of `std` before/after main, especially of featu= res that interact with the\nOS or global state, is exempted from stability = and portability guarantees and instead only\nprovided on a best-effort basi= s. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` an= d `alloc` are most likely to work in such environments with\nthe caveat tha= t any hookable behavior such as panics, oom handling or allocators will als= o\ndepend on the compatibility of the hooks.\n\nSome features may also beha= ve differently outside main, e.g. stdio could become unbuffered,\nsome pani= cs might turn into aborts, backtraces might not get symbolicated or similar= .\n\nNon-exhaustive list of known limitations:\n\n- after-main use of threa= d-locals, which also affects additional features:\n - [`thread::current()`= ]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file de= scriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[= `MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crat= e::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::Udp= Socket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`F= romStr`]: str::FromStr\n[`HashMap<K, V>`]: collections::HashMap\n[`Mutex`]:= sync::Mutex\n[`Option<T>`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: c= ell::RefCell\n[`Result<T, E>`]: result::Result\n[`Vec<T>`]: vec::Vec\n[`ato= mic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-thr= ough-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std:= :cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[= `use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\= n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.h= tml#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\= n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-docume= ntation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]= : https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "std" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "std") :additionalTextEdits []) (:label "core" :kind 9 :documentation (:kind "markdown" :value "# The Rust Core Library\n\nThe Rust Core Li= brary is the dependency-free[^free] foundation of [The\nRust Standard Libra= ry](../std/index.html). It is the portable glue\nbetween the language and i= ts libraries, defining the intrinsic and\nprimitive building blocks of all = Rust code. It links to no\nupstream libraries, no system libraries, and no = libc.\n\n[^free]: Strictly speaking, there are some symbols which are neede= d but\n they aren't always necessary.\n\nThe core library is *minim= al*: it isn't even aware of heap allocation,\nnor does it provide concurren= cy or I/O. These things require\nplatform integration, and this library is = platform-agnostic.\n\n# How to use the core library\n\nPlease note that all= of these details are currently not considered stable.\n\nThis library is b= uilt on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`,= `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n w= hich are generated by Rust codegen backends. Additionally, this library can= make explicit\n calls to `strlen`. Their signatures are the same as found= in C, but there are extra\n assumptions about their semantics: For `memcp= y`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0= , the function is assumed to not be UB, even if the pointers are NULL or\n = dangling. (Note that making extra assumptions about these functions is com= mon among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](= https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)= \n These functions are often provided by the system libc, but can also be = provided by the\n [compiler-builtins crate](https://crates.io/crates/compi= ler_builtins).\n Note that the library does not guarantee that it will alw= ays make these assumptions, so Rust\n user code directly calling the C fun= ctions should follow the C specification! The advice for\n Rust user code = is to call the functions provided by this library instead (such as\n `ptr:= :copy`).\n\n* Panic handler - This function takes one argument, a `&panic::= PanicInfo`. It is up to consumers of this core\n library to define this pa= nic function; it is only required to never\n return. You should mark your = implementation using `#[panic_handler]`.\n\n* `rust_eh_personality` - is us= ed by the failure mechanisms of the\n compiler. This is often mapped to G= CC's personality function, but crates\n which do not trigger a panic can = be assured that this function is never\n called. The `lang` attribute is = called `eh_personality`.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "core" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "core") :additionalTextEdits []) (:label "u32" :kind 22 :detail "u32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u32") :additionalTextEdits []) (:label "bool" :kind 22 :detail "bool" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "bool" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "bool") :additionalTextEdits []) (:label "u8" :kind 22 :detail "u8" :deprecated :json-false :preselect = t :sortText "ffffffef" :filterText "u8" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u8") :additionalTextEdits []) (:label "isize" :kind 22 :detail "isize" :deprecated :json-false :pres= elect t :sortText "ffffffef" :filterText "isize" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "isize") :additionalTextEdits []) (:label "u16" :kind 22 :detail "u16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u16") :additionalTextEdits []) (:label "u64" :kind 22 :detail "u64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u64") :additionalTextEdits []) (:label "u128" :kind 22 :detail "u128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "u128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u128") :additionalTextEdits []) (:label "f32" :kind 22 :detail "f32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f32") :additionalTextEdits []) (:label "i128" :kind 22 :detail "i128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "i128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i128") :additionalTextEdits []) (:label "i16" :kind 22 :detail "i16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i16") :additionalTextEdits []) (:label "str" :kind 22 :detail "str" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "str" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "str") :additionalTextEdits []) (:label "i64" :kind 22 :detail "i64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i64") :additionalTextEdits []) (:label "char" :kind 22 :detail "char" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "char" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "char") :additionalTextEdits []) (:label "f128" :kind 22 :detail "f128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "f128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f128") :additionalTextEdits []) (:label "f64" :kind 22 :detail "f64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f64") :additionalTextEdits []) (:label "f16" :kind 22 :detail "f16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f16") :additionalTextEdits []) (:label "i32" :kind 22 :detail "i32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i32") :additionalTextEdits []) (:label "i8" :kind 22 :detail "i8" :deprecated :json-false :preselect = t :sortText "ffffffef" :filterText "i8" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i8") :additionalTextEdits []) (:label "usize" :kind 22 :detail "usize" :deprecated :json-false :pres= elect t :sortText "ffffffef" :filterText "usize" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "usize") :additionalTextEdits []) (:label "AsMut" :kind 8 :documentation (:kind "markdown" :value "Used to do a cheap mutable-to-mutable refer= ence conversion.\n\nThis trait is similar to [`AsRef`] but used for convert= ing between mutable\nreferences. If you need to do a costly conversion it i= s better to\nimplement [`From`] with type `&mut T` or write a custom functi= on.\n\n**Note: This trait must not fail**. If the conversion can fail, use = a\ndedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].\n= \n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type = is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` h= as type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reason= s, the above currently does not hold generally for all\n[mutably dereferenc= eable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(fo= o).as_mut()`. Instead, many smart pointers provide an `as_mut` implementati= on which\nsimply returns a reference to the [pointed-to value] (but do not = perform a cheap\nreference-to-reference conversion for that value). However= , [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable der= eferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferen= ceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::T= arget\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n= ```rust\nlet mut x =3D Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = =3D x.as_mut();\n// Better just write:\nlet y: &mut i32 =3D &mut x;\n```\n\= nTypes which implement [`DerefMut`] should consider to add an implementatio= n of `AsMut<T>` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rus= t\nimpl<T> AsMut<T> for SomeType\nwhere\n <SomeType as Deref>::Target: A= sMut<T>,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut()= .as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be refl= exive, i.e. there would be an `impl<T: ?Sized> AsMut<T> for T`\nwith [`as_m= ut`] simply returning its argument unchanged.\nSuch a blanket implementatio= n is currently *not* provided due to technical restrictions of\nRust's type= system (it would be overlapping with another existing blanket implementati= on for\n`&mut T where T: AsMut<U>` which allows `AsMut` to auto-dereference= , see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\n= A trivial implementation of `AsMut<T> for T` must be added explicitly for a= particular type `T`\nwhere needed or desired. Note, however, that not all = types from `std` contain such an\nimplementation, and those cannot be added= by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as tr= ait bound for a generic function, we can accept all mutable references that= \ncan be converted to type `&mut T`. Unlike [dereference], which has a sing= le [target type],\nthere can be multiple implementations of `AsMut` for a t= ype. In particular, `Vec<T>` implements\nboth `AsMut<Vec<T>>` and `AsMut<[T= ]>`.\n\nIn the following, the example functions `caesar` and `null_terminat= e` provide a generic\ninterface which work with any type that can be conver= ted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or b= yte vector (`Vec<u8>`), respectively.\n\n[dereference]: core::ops::DerefMut= \n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n = info: String,\n content: Vec<u8>,\n}\n\nimpl<T: ?Sized> AsMut<T> for D= ocument\nwhere\n Vec<u8>: AsMut<T>,\n{\n fn as_mut(&mut self) -> &mut= T {\n self.content.as_mut()\n }\n}\n\nfn caesar<T: AsMut<[u8]>>(= data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = =3D byte.wrapping_add(key);\n }\n}\n\nfn null_terminate<T: AsMut<Vec<u8>= >>(data: &mut T) {\n // Using a non-generic inner function, which contai= ns most of the\n // functionality, helps to minimize monomorphization ov= erhead.\n fn doit(data: &mut Vec<u8>) {\n let len =3D data.len();= \n if len =3D=3D 0 || data[len-1] !=3D 0 {\n data.push(0)= ;\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mu= t v: Vec<u8> =3D vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, = [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\= n let mut doc =3D Document {\n info: String::from(\"Example\"),\n= content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n as= sert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n ass= ert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs d= on't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec<u= 8>`, for example, is the better choice (callers need to pass the correct ty= pe then).") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "AsMut" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "AsMut") :additionalTextEdits []) (:label "AsRef" :kind 8 :documentation (:kind "markdown" :value "Used to do a cheap reference-to-reference c= onversion.\n\nThis trait is similar to [`AsMut`] which is used for converti= ng between mutable references.\nIf you need to do a costly conversion it is= better to implement [`From`] with type\n`&T` or write a custom function.\n= \n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], b= ut [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`= ] has a blanket impl for any `T`, and can be used to accept either\n a ref= erence or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`B= orrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed valu= e are\n equivalent to those of the owned value. For this reason, if you wa= nt to\n borrow only a single field of a struct you can implement `AsRef`, = but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversio= n can fail, use a\ndedicated method which returns an [`Option<T>`] or a [`R= esult<T, E>`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if= the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()= ` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote = that due to historic reasons, the above currently does not hold generally f= or all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the sa= me as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `a= s_ref` implementation which\nsimply returns a reference to the [pointed-to = value] (but do not perform a cheap\nreference-to-reference conversion for t= hat value). However, [`AsRef::as_ref`] should not be\nused for the sole pur= pose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[derefe= renceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::T= arget\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nle= t x =3D Box::new(5i32);\n// Avoid this:\n// let y: &i32 =3D x.as_ref();\n//= Better just write:\nlet y: &i32 =3D &x;\n```\n\nTypes which implement [`De= ref`] should consider implementing `AsRef<T>` as follows:\n\n[`Deref`]: cor= e::ops::Deref\n\n```rust\nimpl<T> AsRef<T> for SomeType\nwhere\n T: ?Siz= ed,\n <SomeType as Deref>::Target: AsRef<T>,\n{\n fn as_ref(&self) ->= &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIde= ally, `AsRef` would be reflexive, i.e. there would be an `impl<T: ?Sized> A= sRef<T> for T`\nwith [`as_ref`] simply returning its argument unchanged.\nS= uch a blanket implementation is currently *not* provided due to technical r= estrictions of\nRust's type system (it would be overlapping with another ex= isting blanket implementation for\n`&T where T: AsRef<U>` which allows `AsR= ef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_r= ef`]: AsRef::as_ref\n\nA trivial implementation of `AsRef<T> for T` must be= added explicitly for a particular type `T`\nwhere needed or desired. Note,= however, that not all types from `std` contain such an\nimplementation, an= d those cannot be added by external code due to orphan rules.\n\n# Examples= \n\nBy using trait bounds we can accept arguments of different types as lon= g as they can be\nconverted to the specified type `T`.\n\nFor example: By c= reating a generic function that takes an `AsRef<str>` we express that we\nw= ant to accept all references that can be converted to [`&str`] as an argume= nt.\nSince both [`String`] and [`&str`] implement `AsRef<str>` we can accep= t both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::bo= rrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]:= ../../std/string/struct.String.html\n\n```rust\nfn is_hello<T: AsRef<str>>= (s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s =3D \"hello\";\= nis_hello(s);\n\nlet s =3D \"hello\".to_string();\nis_hello(s);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "AsRef" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "AsRef") :additionalTextEdits []) (:label "Box" :kind 22 :detail "Box<{unknown}, {unknown}>" :documentat= ion (:kind "markdown" :value "A pointer type that uniquely owns a heap al= location of type `T`.\n\nSee the [module-level documentation](../../std/box= ed/index.html) for more.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Box" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Box") :additionalTextEdits []) (:label "Clone" :kind 8 :documentation (:kind "markdown" :value "A common trait for the ability to explicitl= y duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implici= t and an inexpensive bit-wise copy, while\n`Clone` is always explicit and m= ay or may not be expensive. In order to enforce\nthese characteristics, Rus= t does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clo= ne` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`],= you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## De= rivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone= `. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field= .\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implement= s `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n= ```rust\n// `derive` implements Clone for Reading<T> when T is Clone.\n#[de= rive(Clone)]\nstruct Reading<T> {\n frequency: T,\n}\n```\n\n## How can = I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial imple= mentation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, th= en `let x =3D y.clone();` is equivalent to `let x =3D *y;`.\nManual impleme= ntations should be careful to uphold this invariant; however, unsafe code\n= must not rely on it to ensure memory safety.\n\nAn example is a generic str= uct holding a function pointer. In this case, the\nimplementation of `Clone= ` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Genera= te<T>(fn() -> T);\n\nimpl<T> Copy for Generate<T> {}\n\nimpl<T> Clone for G= enerate<T> {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n= \nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate<T>(fn= () -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T= : Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl= <T: Copy> Copy for Generate<T> { }\n\n// Automatically derived\nimpl<T: Clo= ne> Clone for Generate<T> {\n fn clone(&self) -> Generate<T> {\n = Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessar= y because clearly the function itself should be\ncopy- and cloneable even i= f its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Genera= te<T>(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() ->= NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).cl= one(); // error: trait bounds were not satisfied\n// Note: With the manual = implementations the above line will compile.\n```\n\n## Additional implemen= tors\n\nIn addition to the [implementors listed below][impls],\nthe followi= ng types also implement `Clone`:\n\n* Function item types (i.e., the distin= ct types defined for each function)\n* Function pointer types (e.g., `fn() = -> i32`)\n* Closure types, if they capture no value from the environment\n = or if all such captured values implement `Clone` themselves.\n Note that = variables captured by shared reference always implement `Clone`\n (even if= the referent doesn't),\n while variables captured by mutable reference ne= ver implement `Clone`.\n\n[impls]: #implementors") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Clone" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Clone") :additionalTextEdits []) (:label "Copy" :kind 8 :documentation (:kind "markdown" :value "Types whose values can be duplicated simply= by copying bits.\n\nBy default, variable bindings have 'move semantics.' I= n other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x =3D Foo;= \n\nlet y =3D x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// = println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a typ= e implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can= derive a `Copy` implementation. `Clone` is also required, as it's\n// a su= pertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = =3D Foo;\n\nlet y =3D x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\");= // A-OK!\n```\n\nIt's important to note that in these two examples, the on= ly difference is whether you\nare allowed to access `x` after the assignmen= t. Under the hood, both a copy and a move\ncan result in bits being copied = in memory, although this is sometimes optimized away.\n\n## How can I imple= ment `Copy`?\n\nThere are two ways to implement `Copy` on your type. The si= mplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStr= uct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust= \nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct= {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nTher= e is a small difference between the two: the `derive` strategy will also pl= ace a `Copy`\nbound on type parameters, which isn't always desired.\n\n## W= hat's the difference between `Copy` and `Clone`?\n\nCopies happen implicitl= y, for example as part of an assignment `y =3D x`. The behavior of\n`Copy` = is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an = explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide = any type-specific behavior necessary to duplicate values safely. For exampl= e,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointe= d-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values= would merely copy the\npointer, leading to a double free down the line. Fo= r this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a s= upertrait of `Copy`, so everything which is `Copy` must also implement\n[`C= lone`]. If a type is `Copy` then its [`Clone`] implementation only needs to= return `*self`\n(see the example above).\n\n## When can my type be `Copy`?= \n\nA type can implement `Copy` if all of its components implement `Copy`. = For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]= \nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`,= and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy con= trast, consider\n\n```rust\nstruct PointList {\n points: Vec<Point>,\n}\= n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec<T>`] = is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get = an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type;= field `points` does not implement `Copy`\n```\n\nShared references (`&T`) = are also `Copy`, so a type can be `Copy`, even when it holds\nshared refere= nces of types `T` that are *not* `Copy`. Consider the following struct,\nwh= ich can implement `Copy`, because it only holds a *shared reference* to our= non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)= ]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n``= `\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safel= y. For example, copying `&mut T` would create an aliased\nmutable reference= . Copying [`String`] would duplicate responsibility for managing the\n[`Str= ing`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, = any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some= resource besides its own [`size_of::<T>`] bytes.\n\nIf you try to implemen= t `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe = error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should*= my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Co= py`, it should. Keep in mind, though,\nthat implementing `Copy` is part of = the public API of your type. If the type might become\nnon-`Copy` in the fu= ture, it could be prudent to omit the `Copy` implementation now, to\navoid = a breaking API change.\n\n## Additional implementors\n\nIn addition to the = [implementors listed below][impls],\nthe following types also implement `Co= py`:\n\n* Function item types (i.e., the distinct types defined for each fu= nction)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, i= f they capture no value from the environment\n or if all such captured val= ues implement `Copy` themselves.\n Note that variables captured by shared = reference always implement `Copy`\n (even if the referent doesn't),\n whi= le variables captured by mutable reference never implement `Copy`.\n\n[`Vec= <T>`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.S= tring.html\n[`size_of::<T>`]: crate::mem::size_of\n[impls]: #implementors") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Copy" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Copy") :additionalTextEdits []) (:label "Default" :kind 8 :documentation (:kind "markdown" :value "A trait for giving a type a useful default = value.\n\nSometimes, you want to fall back to some kind of default value, a= nd\ndon't particularly care what it is. This comes up often with `struct`s\= nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i= 32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You ca= n use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n = foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = =3D Default::default();\n}\n```\n\nNow, you get all of the default values. = Rust implements `Default` for various primitives types.\n\nIf you want to o= verride a particular option, but still retain the other defaults:\n\n```rus= t\nfn main() {\n let options =3D SomeOptions { foo: 42, ..Default::defau= lt() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` = if all of the type's fields implement\n`Default`. When `derive`d, it will u= se the default value for each field's type.\n\n### `enum`s\n\nWhen using `#= [derive(Default)]` on an `enum`, you need to choose which unit variant will= be\ndefault. You do this by placing the `#[default]` attribute on the vari= ant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n = B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-u= nit or non-exhaustive variants.\n\nThe `#[default]` attribute was stabilize= d in Rust 1.62.0.\n\n## How can I implement `Default`?\n\nProvide an implem= entation for the `default()` method that returns the value of\nyour type th= at should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n= }\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\= n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo= : i32,\n bar: f32,\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Default" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Default") :additionalTextEdits []) (:label "DoubleEndedIterator" :kind 8 :documentation (:kind "markdown" :value "An iterator able to yield elements from bot= h ends.\n\nSomething that implements `DoubleEndedIterator` has one extra ca= pability\nover something that implements [`Iterator`]: the ability to also = take\n`Item`s from the back, as well as the front.\n\nIt is important to no= te that both back and forth work on the same range,\nand do not cross: iter= ation is over when they meet in the middle.\n\nIn a similar fashion to the = [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from = a [`next_back()`], calling it\nagain may or may not ever return [`Some`] ag= ain. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\= n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::n= ext\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers =3D vec![1, 2, 3,= 4, 5, 6];\n\nlet mut iter =3D numbers.iter();\n\nassert_eq!(Some(&1), iter= .next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), it= er.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), = iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.ne= xt());\nassert_eq!(None, iter.next_back());\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "DoubleEndedIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "DoubleEndedIterator") :additionalTextEdits []) (:label "Drop" :kind 8 :documentation (:kind "markdown" :value "Custom code within the destructor.\n\nWhen = a value is no longer needed, Rust will run a \"destructor\" on that value.\= nThe most common way that a value is no longer needed is when it goes out o= f\nscope. Destructors may still run in other circumstances, but we're going= to\nfocus on scope for the examples here. To learn about some of those oth= er cases,\nplease see [the reference] section on destructors.\n\n[the refer= ence]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destruc= tor consists of two components:\n- A call to `Drop::drop` for that value, i= f this special `Drop` trait is implemented for its type.\n- The automatical= ly generated \"drop glue\" which recursively calls the destructors\n of = all the fields of this value.\n\nAs Rust automatically calls the destructor= s of all contained fields,\nyou don't have to implement `Drop` in most case= s. But there are some cases where\nit is useful, for example for types whic= h directly manage a resource.\nThat resource may be memory, it may be a fil= e descriptor, it may be a network socket.\nOnce a value of that type is no = longer going to be used, it should \"clean up\" its\nresource by freeing th= e memory or closing the file or socket. This is\nthe job of a destructor, a= nd therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors = in action, let's take a look at the following program:\n\n```rust\nstruct H= asDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n print= ln!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: Has= Drop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mu= t self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn mai= n() {\n let _x =3D HasTwoDrops { one: HasDrop, two: HasDrop };\n prin= tln!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` a= nd then for both `_x.one` and `_x.two`,\nmeaning that running this will pri= nt\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping= HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTw= oDrop`, the destructors of its fields are still called.\nThis would result = in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## Yo= u cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clea= n up a value, it may be dangerous to use this value after\nthe method has b= een called. As `Drop::drop` does not take ownership of its input,\nRust pre= vents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other= words, if you tried to explicitly call `Drop::drop` in the above example, = you'd get a compiler error.\n\nIf you'd like to explicitly call the destruc= tor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n= \n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For stru= cts, it's the same\norder that they're declared: first `one`, then `two`. I= f you'd like to try\nthis yourself, you can modify `HasDrop` above to conta= in some data, like an\ninteger, and then use it in the `println!` inside of= `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for struct= s, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\= nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping= Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut = self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n = let _foo =3D Foo;\n let _bar =3D Bar;\n}\n```\n\nThis will print\n\n```t= ext\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for th= e full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destr= uctors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement b= oth [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implic= itly duplicated by the compiler, making it very\nhard to predict when, and = how often destructors will be executed. As such,\nthese types cannot have d= estructors.\n\n## Drop check\n\nDropping interacts with the borrow checker = in subtle ways: when a type `T` is being implicitly\ndropped as some variab= le of this type goes out of scope, the borrow checker needs to ensure that\= ncalling `T`'s destructor at this moment is safe. In particular, it also ne= eds to be safe to\nrecursively drop all the fields of `T`. For example, it = is crucial that code like the following\nis being rejected:\n\n```rust\nuse= std::cell::Cell;\n\nstruct S<'a>(Cell<Option<&'a S<'a>>>, Box<i32>);\nimpl= Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) =3D sel= f.0.get() {\n // Print the contents of the `Box` in `r`.\n = println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Se= t up two `S` that point to each other.\n let s1 =3D S(Cell::new(None), B= ox::new(42));\n let s2 =3D S(Cell::new(Some(&s1)), Box::new(42));\n s= 1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the= 2nd one\n // to be dropped will access the `Box` in the first one,\n = // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need fo= r [drop check in more detail][drop check].\n\nTo reject such code, the \"dr= op check\" analysis determines which types and lifetimes need to\nstill be = live when `T` gets dropped. The exact details of this analysis are not yet\= nstably guaranteed and **subject to change**. Currently, the analysis works= as follows:\n- If `T` has no drop glue, then trivially nothing is required= to be live. This is the case if\n neither `T` nor any of its (recursive) = fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDr= op`] are considered to never have a destructor, no matter their field type.= \n- If `T` has drop glue, then, for all types `U` that are *owned* by any f= ield of `T`,\n recursively add the types and lifetimes that need to be liv= e when `U` gets dropped. The set of\n owned types is determined by recursi= vely traversing `T`:\n - Recursively descend through `PhantomData`, `Box`,= tuples, and arrays (including arrays of\n length 0).\n - Stop at refer= ence and raw pointer types as well as function pointers and function items;= \n they do not own anything.\n - Stop at non-composite types (type para= meters that remain generic in the current context and\n base types such = as integers and `bool`); these types are owned.\n - When hitting an ADT wi= th `impl Drop`, stop there; this type is owned.\n - When hitting an ADT wi= thout `impl Drop`, recursively descend to its fields. (For an `enum`,\n = consider all fields of all variants.)\n- Furthermore, if `T` implements `Dr= op`, then all generic (lifetime and type) parameters of `T`\n must be live= .\n\nIn the above example, the last clause implies that `'a` must be live w= hen `S<'a>` is dropped,\nand hence the example is rejected. If we remove th= e `impl Drop`, the liveness requirement\ndisappears and the example is acce= pted.\n\nThere exists an unstable way for a type to opt-out of the last cla= use; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more deta= ils on this nightly-only feature, see the\n[discussion in the Nomicon][nomi= con].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate= ::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: = ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standa= rd-library-and-its-unstable-may_dangle") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Drop" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Drop") :additionalTextEdits []) (:label "Eq (alias =3D=3D, !=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for comparisons corresponding to [equ= ivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\= n\nThis means, that in addition to `a =3D=3D b` and `a !=3D b` being strict= inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive= : `a =3D=3D a`;\n- symmetric: `a =3D=3D b` implies `b =3D=3D a` (required b= y `PartialEq` as well); and\n- transitive: `a =3D=3D b` and `b =3D=3D c` im= plies `a =3D=3D c` (required by `PartialEq` as well).\n\nThis property cann= ot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], a= nd has no extra methods.\n\nViolating this property is a logic error. The b= ehavior resulting from a logic error is not\nspecified, but users of the tr= ait must ensure that such logic errors do *not* result in\nundefined behavi= or. This means that `unsafe` code **must not** rely on the correctness of t= hese\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guarant= eed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in add= ition to\nthe symmetric and transitive properties already required by `Part= ialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `d= erive`d, because `Eq` has\nno extra methods, it is only informing the compi= ler that this is an\nequivalence relation rather than a partial equivalence= relation. Note that\nthe `derive` strategy requires all fields are `Eq`, w= hich isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you canno= t use the `derive` strategy, specify that your type implements\n`Eq`, which= has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }= \nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq= for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn = =3D=3D other.isbn\n }\n}\nimpl Eq for Book {}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Eq" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Eq") :additionalTextEdits []) (:label "ExactSizeIterator" :kind 8 :documentation (:kind "markdown" :value "An iterator that knows its exact length.\n\= nMany [`Iterator`]s don't know how many times they will iterate, but some d= o.\nIf an iterator knows how many times it can iterate, providing access to= \nthat information can be useful. For example, if you want to iterate\nback= wards, a good start is to know where the end is.\n\nWhen implementing an `E= xactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, th= e implementation of [`Iterator::size_hint`]\n*must* return the exact size o= f the iterator.\n\nThe [`len`] method has a default implementation, so you = usually shouldn't\nimplement it. However, you may be able to provide a more= performant\nimplementation than the default, so overriding it in this case= makes sense.\n\nNote that this trait is a safe trait and as such does *not= * and *cannot*\nguarantee that the returned length is correct. This means t= hat `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size= _hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen)= trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len= \n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter = makes an iterator *longer*, then it's usually incorrect for\nthat adapter t= o implement `ExactSizeIterator`. The inner exact-sized\niterator might alr= eady be `usize::MAX`-long, and thus the length of the\nlonger adapted itera= tor would no longer be exactly representable in `usize`.\n\nThis is why [`C= hain<A, B>`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` = and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```r= ust\n// a finite range knows exactly how many times it will iterate\nlet fi= ve =3D 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level doc= s], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeI= terator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nim= pl ExactSizeIterator for Counter {\n // We can easily calculate the rema= ining number of iterations.\n fn len(&self) -> usize {\n 5 - self= .count\n }\n}\n\n// And now we can use it!\n\nlet mut counter =3D Counte= r::new();\n\nassert_eq!(5, counter.len());\nlet _ =3D counter.next();\nasse= rt_eq!(4, counter.len());\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ExactSizeIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ExactSizeIterator") :additionalTextEdits []) (:label "Extend" :kind 8 :documentation (:kind "markdown" :value "Extend a collection with the contents of an= iterator.\n\nIterators produce a series of values, and collections can als= o be thought\nof as a series of values. The `Extend` trait bridges this gap= , allowing you\nto extend a collection by including the contents of that it= erator. When\nextending a collection with an already existing key, that ent= ry is updated\nor, in the case of collections that permit multiple entries = with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n= ```rust\n// You can extend a String with some chars:\nlet mut message =3D S= tring::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b= ', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `E= xtend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec<= T>\n#[derive(Debug)]\nstruct MyCollection(Vec<i32>);\n\n// Let's give it so= me methods so we can create one and add things\n// to it.\nimpl MyCollectio= n {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n = }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\= n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32= \nimpl Extend<i32> for MyCollection {\n\n // This is a bit simpler with = the concrete type signature: we can call\n // extend on anything which c= an be turned into an Iterator which gives\n // us i32s. Because we need = i32s to put into MyCollection.\n fn extend<T: IntoIterator<Item=3Di32>>(= &mut self, iter: T) {\n\n // The implementation is very straightforw= ard: loop through the\n // iterator, and add() each element to ourse= lves.\n for elem in iter {\n self.add(elem);\n }\n= }\n}\n\nlet mut c =3D MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.a= dd(7);\n\n// let's extend our collection with three more numbers\nc.extend(= vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\= "MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Extend" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Extend") :additionalTextEdits []) (:label "Fn" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= an immutable receiver.\n\nInstances of `Fn` can be called repeatedly witho= ut mutating state.\n\n*This trait (`Fn`) is not to be confused with [functi= on pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures whi= ch only take immutable\nreferences to captured variables or don't capture a= nything at all, as well\nas (safe) [function pointers] (with some caveats, = see their documentation\nfor more details). Additionally, for any type `F` = that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] a= nd [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as= a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a= bound when you want to accept a parameter of function-like\ntype and need = to call it repeatedly and without mutating state (e.g., when\ncalling it co= ncurrently). If you do not need such strict requirements, use\n[`FnMut`] or= [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Program= ming Language*][book] for\nsome more information on this topic.\n\nAlso of = note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize= `). Those interested in the technical details of\nthis can refer to [the re= levant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-= 01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.ht= ml\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square =3D |x| x *= x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rus= t\nfn call_with_one<F>(func: F) -> usize\n where F: Fn(usize) -> usize {= \n func(1)\n}\n\nlet double =3D |x| x * 2;\nassert_eq!(call_with_one(dou= ble), 2);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Fn" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Fn") :additionalTextEdits []) (:label "FnMut" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and m= ay mutate state.\n\n`FnMut` is implemented automatically by closures which = take mutable\nreferences to captured variables, as well as all types that i= mplement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supe= rtrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`,= `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of = `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expecte= d, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can b= e used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want t= o accept a parameter of function-like\ntype and need to call it repeatedly,= while allowing it to mutate state.\nIf you don't want the parameter to mut= ate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly,= use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming L= anguage*][book] for\nsome more information on this topic.\n\nAlso of note i= s the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Th= ose interested in the technical details of\nthis can refer to [the relevant= section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-clo= sures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n= # Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = =3D 5;\n{\n let mut square_x =3D || x *=3D x;\n square_x();\n}\nasser= t_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice<= F>(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nle= t mut x: usize =3D 1;\n{\n let add_two_to_x =3D || x +=3D 2;\n do_twi= ce(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FnMut" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FnMut") :additionalTextEdits []) (:label "FnOnce" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not= be callable multiple\ntimes. Because of this, if the only thing known abou= t a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`F= nOnce` is implemented automatically by closures that might consume captured= \nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[= function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince = both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`= ] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as= a bound when you want to accept a parameter of function-like\ntype and onl= y need to call it once. If you need to call the parameter\nrepeatedly, use = [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].= \n\nSee the [chapter on closures in *The Rust Programming Language*][book] = for\nsome more information on this topic.\n\nAlso of note is the special sy= ntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested i= n the technical details of\nthis can refer to [the relevant section in the = *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[fun= ction pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n##= Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish<F>(func: F)\= n where F: FnOnce() -> String\n{\n // `func` consumes its captured va= riables, so it cannot be run more\n // than once.\n println!(\"Consum= ed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to= invoke `func()` again will throw a `use of moved\n // value` error for = `func`.\n}\n\nlet x =3D String::from(\"x\");\nlet consume_and_return_x =3D = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_r= eturn_x` can no longer be invoked at this point\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FnOnce" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FnOnce") :additionalTextEdits []) (:label "From" :kind 8 :documentation (:kind "markdown" :value "Used to do value-to-value conversions while= consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne shoul= d always prefer implementing `From` over [`Into`]\nbecause implementing `Fr= om` automatically provides one with an implementation of [`Into`]\nthanks t= o the blanket implementation in the standard library.\n\nOnly implement [`I= nto`] when targeting a version prior to Rust 1.41 and converting to a type\= noutside the current crate.\n`From` was not able to do these types of conve= rsions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`= ] for more details.\n\nPrefer using [`Into`] over using `From` when specify= ing trait bounds on a generic function.\nThis way, types that directly impl= ement [`Into`] can be used as arguments as well.\n\nThe `From` trait is als= o very useful when performing error handling. When constructing a function\= nthat is capable of failing, the return type will generally be of the form = `Result<T, E>`.\n`From` simplifies error handling by allowing a function to= return a single error type\nthat encapsulates multiple error types. See th= e \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: T= his trait must not fail**. The `From` trait is intended for perfect convers= ions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# = Generic Implementations\n\n- `From<T> for U` implies [`Into`]`<U> for T`\n-= `From` is reflexive, which means that `From<T> for T` is implemented\n\n# = When to implement `From`\n\nWhile there's no technical restrictions on whic= h conversions can be done using\na `From` implementation, the general expec= tation is that the conversions\nshould typically be restricted as follows:\= n\n* The conversion is *infallible*: if the conversion can fail, use [`TryF= rom`]\n instead; don't provide a `From` impl that panics.\n\n* The convers= ion is *lossless*: semantically, it should not lose or discard\n informati= on. For example, `i32: From<u16>` exists, where the original\n value can b= e recovered using `u16: TryFrom<i32>`. And `String: From<&str>`\n exists,= where you can get something equivalent to the original value via\n `Deref= `. But `From` cannot be used to convert from `u32` to `u16`, since\n that= cannot succeed in a lossless way. (There's some wiggle room here for\n i= nformation not considered semantically relevant. For example,\n `Box<[T]>= : From<Vec<T>>` exists even though it might not preserve capacity,\n like = how two vectors can be equal despite differing capacities.)\n\n* The conver= sion is *value-preserving*: the conceptual kind and meaning of\n the resul= ting value is the same, even though the Rust type and technical\n represen= tation might be different. For example `-1_i8 as u8` is *lossless*,\n sin= ce `as` casting back can recover the original value, but that conversion\n = is *not* available via `From` because `-1` and `255` are different concept= ual\n values (despite being identical bit patterns technically). But\n `= f32: From<i16>` *is* available because `1_i16` and `1.0_f32` are conceptual= ly\n the same real number (despite having very different bit patterns tech= nically).\n `String: From<char>` is available because they're both *text*,= but\n `String: From<u32>` is *not* available, since `1` (a number) and `\= "1\"`\n (text) are too different. (Converting values to text is instead c= overed\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversi= on is *obvious*: it's the only reasonable conversion between\n the two typ= es. Otherwise it's better to have it be a named method or\n constructor, = like how [`str::as_bytes`] is a method and how integers have\n methods lik= e [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_byt= es`], none of which are `From` implementations. Whereas\n there's only on= e reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [= `IpAddr`](crate::net::IpAddr), thus `IpAddr: From<Ipv6Addr>` exists.\n\n# E= xamples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion fr= om a `&str` to a String is done as follows:\n\n```rust\nlet string =3D \"he= llo\".to_string();\nlet other_string =3D String::from(\"hello\");\n\nassert= _eq!(string, other_string);\n```\n\nWhile performing error handling it is o= ften useful to implement `From` for your own error type.\nBy converting und= erlying error types to our own custom error type that encapsulates the\nund= erlying error type, we can return a single error type without losing inform= ation on the\nunderlying cause. The '?' operator automatically converts the= underlying error type to our\ncustom error type with `From::from`.\n\n```r= ust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoEr= ror(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From<io::Er= ror> for CliError {\n fn from(error: io::Error) -> Self {\n CliEr= ror::IoError(error)\n }\n}\n\nimpl From<num::ParseIntError> for CliError= {\n fn from(error: num::ParseIntError) -> Self {\n CliError::Par= seError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Resu= lt<i32, CliError> {\n let mut contents =3D fs::read_to_string(&file_name= )?;\n let num: i32 =3D contents.trim().parse()?;\n Ok(num)\n}\n```\n\= n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[bo= ok]: ../../book/ch09-00-error-handling.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "From" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "From") :additionalTextEdits []) (:label "FromIterator" :kind 8 :documentation (:kind "markdown" :value "Conversion from an [`Iterator`].\n\nBy impl= ementing `FromIterator` for a type, you define how it will be\ncreated from= an iterator. This is common for types which describe a\ncollection of some= kind.\n\nIf you want to create a collection from the contents of an iterat= or, the\n[`Iterator::collect()`] method is preferred. However, when you nee= d to\nspecify the container type, [`FromIterator::from_iter()`] can be more= \nreadable than using a turbofish (e.g. `::<Vec<_>>()`). See the\n[`Iterato= r::collect()`] documentation for more examples of its use.\n\nSee also: [`I= ntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives =3D= std::iter::repeat(5).take(5);\n\nlet v =3D Vec::from_iter(five_fives);\n\n= assert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] t= o implicitly use `FromIterator`:\n\n```rust\nlet five_fives =3D std::iter::= repeat(5).take(5);\n\nlet v: Vec<i32> =3D five_fives.collect();\n\nassert_e= q!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as = a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse st= d::collections::VecDeque;\nlet first =3D (0..10).collect::<VecDeque<i32>>()= ;\nlet second =3D VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);= \n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample= collection, that's just a wrapper over Vec<T>\n#[derive(Debug)]\nstruct My= Collection(Vec<i32>);\n\n// Let's give it some methods so we can create one= and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollecti= on {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem= : i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement Fr= omIterator\nimpl FromIterator<i32> for MyCollection {\n fn from_iter<I: = IntoIterator<Item=3Di32>>(iter: I) -> Self {\n let mut c =3D MyColle= ction::new();\n\n for i in iter {\n c.add(i);\n }\= n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = =3D (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = =3D MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);= \n\n// collect works too!\n\nlet iter =3D (0..5).into_iter();\nlet c: MyCol= lection =3D iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FromIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FromIterator") :additionalTextEdits []) (:label "Into" :kind 8 :documentation (:kind "markdown" :value "A value-to-value conversion that consumes t= he input value. The\nopposite of [`From`].\n\nOne should avoid implementing= [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatica= lly provides one with an implementation of [`Into`]\nthanks to the blanket = implementation in the standard library.\n\nPrefer using [`Into`] over [`Fro= m`] when specifying trait bounds on a generic function\nto ensure that type= s that only implement [`Into`] can be used as well.\n\n**Note: This trait m= ust not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic I= mplementations\n\n- [`From`]`<T> for U` implies `Into<U> for T`\n- [`Into`]= is reflexive, which means that `Into<T> for T` is implemented\n\n# Impleme= nting [`Into`] for conversions to external types in old versions of Rust\n\= nPrior to Rust 1.41, if the destination type was not part of the current cr= ate\nthen you couldn't implement [`From`] directly.\nFor example, take this= code:\n\n```rust\nstruct Wrapper<T>(Vec<T>);\nimpl<T> From<Wrapper<T>> for= Vec<T> {\n fn from(w: Wrapper<T>) -> Vec<T> {\n w.0\n }\n}\n`= ``\nThis will fail to compile in older versions of the language because Rus= t's orphaning rules\nused to be a little bit more strict. To bypass this, y= ou could implement [`Into`] directly:\n\n```rust\nstruct Wrapper<T>(Vec<T>)= ;\nimpl<T> Into<Vec<T>> for Wrapper<T> {\n fn into(self) -> Vec<T> {\n = self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] = does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]= ). Therefore, you should always try to implement [`From`]\nand then fall ba= ck to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`= ] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that w= e want a generic function to take all arguments that can be\nconverted to a= specified type `T`, we can use a trait bound of [`Into`]`<T>`.\nFor exampl= e: The function `is_hello` takes all arguments that can be converted into a= \n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello<T: Into<Vec<u8>>>(s: T) {\n = let bytes =3D b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\= nlet s =3D \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../s= td/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Into" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Into") :additionalTextEdits []) (:label "IntoIterator" :kind 8 :documentation (:kind "markdown" :value "Conversion into an [`Iterator`].\n\nBy impl= ementing `IntoIterator` for a type, you define how it will be\nconverted to= an iterator. This is common for types which describe a\ncollection of some= kind.\n\nOne benefit of implementing `IntoIterator` is that your type will= [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterat= or).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rus= t\nlet v =3D [1, 2, 3];\nlet mut iter =3D v.into_iter();\n\nassert_eq!(Some= (1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), = iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoItera= tor` for your type:\n\n```rust\n// A sample collection, that's just a wrapp= er over Vec<T>\n#[derive(Debug)]\nstruct MyCollection(Vec<i32>);\n\n// Let'= s give it some methods so we can create one and add things\n// to it.\nimpl= MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::= new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(el= em);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator fo= r MyCollection {\n type Item =3D i32;\n type IntoIter =3D std::vec::I= ntoIter<Self::Item>;\n\n fn into_iter(self) -> Self::IntoIter {\n = self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nle= t mut c =3D MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(= 0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor= (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n``= `\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe = input collection type to change, so long as it is still an\niterator. Addit= ional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn col= lect_as_strings<T>(collection: T) -> Vec<String>\nwhere\n T: IntoIterato= r,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\= n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "IntoIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "IntoIterator") :additionalTextEdits []) (:label "Iterator" :kind 8 :documentation (:kind "markdown" :value "A trait for dealing with iterators.\n\nThis= is the main iterator trait. For more about the concept of iterators\ngener= ally, please see the [module-level documentation]. In particular, you\nmay = want to know how to [implement `Iterator`][impl].\n\n[module-level document= ation]: crate::iter\n[impl]: crate::iter#implementing-iterator") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Iterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Iterator") :additionalTextEdits []) (:label "Option" :kind 13 :detail "Option<{unknown}>" :documentation (:kind "markdown" :value "The `Option` type. See [the module level do= cumentation](self) for more.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Option" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Option") :additionalTextEdits []) (:label "Ord (alias <, >, <=3D, >=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for types that form a [total order](h= ttps://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consi= stent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and= `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) =3D=3D Some(cmp= (a, b))`.\n- `max(a, b) =3D=3D max_by(a, b, cmp)` (ensured by the default i= mplementation).\n- `min(a, b) =3D=3D min_by(a, b, cmp)` (ensured by the def= ault implementation).\n- For `a.clamp(min, max)`, see the [method docs](#me= thod.clamp)\n (ensured by the default implementation).\n\nIt's easy to acc= identally make `cmp` and `partial_cmp` disagree by\nderiving some of the tr= aits and manually implementing others.\n\nViolating these requirements is a= logic error. The behavior resulting from a logic error is not\nspecified, = but users of the trait must ensure that such logic errors do *not* result i= n\nundefined behavior. This means that `unsafe` code **must not** rely on t= he correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and t= he requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:= \n\n- exactly one of `a < b`, `a =3D=3D b` or `a > b` is true; and\n- `<` i= s transitive: `a < b` and `b < c` implies `a < c`. The same must hold for b= oth `=3D=3D` and `>`.\n\nMathematically speaking, the `<` operator defines = a strict [weak order]. In\ncases where `=3D=3D` conforms to mathematical eq= uality, it also defines a\nstrict [total order].\n\n[weak order]: https://e= n.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org= /wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]= `.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https:/= /en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-b= ottom declaration order of the struct's members.\n\nWhen `derive`d on enums= , variants are ordered primarily by their discriminants.\nSecondarily, they= are ordered by their fields.\nBy default, the discriminant is smallest for= variants at the top, and\nlargest for variants at the bottom. Here's an ex= ample:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n = Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manu= ally setting the discriminants can override this default\nbehavior:\n\n```r= ust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top =3D 2,\n = Bottom =3D 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographi= cal comparison\n\nLexicographical comparison is an operation with the follo= wing properties:\n - Two sequences are compared element by element.\n - The= first mismatching element defines which sequence is lexicographically less= or greater than the other.\n - If one sequence is a prefix of another, the= shorter sequence is lexicographically less than the other.\n - If two sequ= ences have equivalent elements and are of the same length, then the sequenc= es are lexicographically equal.\n - An empty sequence is lexicographically = less than any non-empty sequence.\n - Two empty sequences are lexicographic= ally equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the typ= e also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen= you must define an implementation for [`cmp`]. You may find it useful to u= se\n[`cmp`] on your type's fields.\n\nHere's an example where you want to s= ort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse s= td::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n nam= e: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self,= other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }= \n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self= ) -> Option<Ordering> {\n Some(self.cmp(other))\n }\n}\n\nimpl Pa= rtialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n sel= f.height =3D=3D other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Ord" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Ord") :additionalTextEdits []) (:label "PartialEq (alias =3D=3D, !=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for comparisons using the equality op= erator.\n\nImplementing this trait for types provides the `=3D=3D` and `!= =3D` operators for\nthose types.\n\n`x.eq(y)` can also be written `x =3D=3D= y`, and `x.ne(y)` can be written `x !=3D y`.\nWe use the easier-to-read in= fix notation in the remainder of this documentation.\n\nThis trait allows f= or comparisons using the equality operator, for types\nthat do not have a f= ull equivalence relation. For example, in floating point\nnumbers `NaN !=3D= NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`].= Formally speaking, when `Rhs =3D=3D Self`, this trait corresponds\nto a [p= artial equivalence relation].\n\n[partial equivalence relation]: https://en= .wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must en= sure that `eq` and `ne` are consistent with each other:\n\n- `a !=3D b` if = and only if `!(a =3D=3D b)`.\n\nThe default implementation of `ne` provides= this consistency and is almost\nalways sufficient. It should not be overri= dden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also imp= lemented for `Self` and `Rhs`, their methods must also\nbe consistent with = `PartialEq` (see the documentation of those traits for the exact\nrequireme= nts). It's easy to accidentally make them disagree by deriving some of the = traits and\nmanually implementing others.\n\nThe equality relation `=3D=3D`= must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`,= `B`, `C`):\n\n- **Symmetry**: if `A: PartialEq<B>` and `B: PartialEq<A>`, = then **`a =3D=3D b`\n implies `b =3D=3D a`**; and\n\n- **Transitivity**: i= f `A: PartialEq<B>` and `B: PartialEq<C>` and `A:\n PartialEq<C>`, then **= `a =3D=3D b` and `b =3D=3D c` implies `a =3D=3D c`**.\n This must also wor= k for longer chains, such as when `A: PartialEq<B>`, `B: PartialEq<C>`,\n = `C: PartialEq<D>`, and `A: PartialEq<D>` all exist.\n\nNote that the `B: Pa= rtialEq<A>` (symmetric) and `A: PartialEq<C>`\n(transitive) impls are not f= orced to exist, but these requirements apply\nwhenever they do exist.\n\nVi= olating these requirements is a logic error. The behavior resulting from a = logic error is not\nspecified, but users of the trait must ensure that such= logic errors do *not* result in\nundefined behavior. This means that `unsa= fe` code **must not** rely on the correctness of these\nmethods.\n\n## Cros= s-crate considerations\n\nUpholding the requirements stated above can becom= e tricky when one crate implements `PartialEq`\nfor a type of another crate= (i.e., to allow comparing one of its own types with a type from the\nstand= ard library). The recommendation is to never implement this trait for a for= eign type. In\nother words, such a crate should do `impl PartialEq<ForeignT= ype> for LocalType`, but it should\n*not* do `impl PartialEq<LocalType> for= ForeignType`.\n\nThis avoids the problem of transitive chains that criss-c= ross crate boundaries: for all local\ntypes `T`, you may assume that no oth= er crate will add `impl`s that allow comparing `T =3D=3D U`. In\nother word= s, if other crates add `impl`s that allow building longer transitive chains= `U1 =3D=3D ...\n=3D=3D T =3D=3D V1 =3D=3D ...`, then all the types that ap= pear to the right of `T` must be types that the\ncrate defining `T` already= knows about. This rules out transitive chains where downstream crates\ncan= add new `impl`s that \"stitch together\" comparisons of foreign types in w= ays that violate\ntransitivity.\n\nNot having such foreign `impl`s also avo= ids forward compatibility issues where one crate adding\nmore `PartialEq` i= mplementations can cause build failures in downstream crates.\n\n## Derivab= le\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, t= wo\ninstances are equal if all fields are equal, and not equal if any field= s\nare not equal. When `derive`d on enums, two instances are equal if they\= nare the same variant and all fields are equal.\n\n## How can I implement `= PartialEq`?\n\nAn example implementation for a domain in which two books ar= e considered\nthe same book if their ISBN matches, even if the formats diff= er:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook= ,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl P= artialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self= .isbn =3D=3D other.isbn\n }\n}\n\nlet b1 =3D Book { isbn: 3, format: Boo= kFormat::Paperback };\nlet b2 =3D Book { isbn: 3, format: BookFormat::Ebook= };\nlet b3 =3D Book { isbn: 10, format: BookFormat::Paperback };\n\nassert= !(b1 =3D=3D b2);\nassert!(b1 !=3D b3);\n```\n\n## How can I compare two dif= ferent types?\n\nThe type you can compare with is controlled by `PartialEq`= 's type parameter.\nFor example, let's tweak our previous code a bit:\n\n``= `rust\n// The derive implements <BookFormat> =3D=3D <BookFormat> comparison= s\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n= Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\= n\n// Implement <Book> =3D=3D <BookFormat> comparisons\nimpl PartialEq<Book= Format> for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n = self.format =3D=3D *other\n }\n}\n\n// Implement <BookFormat> =3D=3D <B= ook> comparisons\nimpl PartialEq<Book> for BookFormat {\n fn eq(&self, o= ther: &Book) -> bool {\n *self =3D=3D other.format\n }\n}\n\nlet = b1 =3D Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 =3D= =3D BookFormat::Paperback);\nassert!(BookFormat::Ebook !=3D b1);\n```\n\nBy= changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book= `,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison lik= e the one above, which ignores some fields of the struct,\ncan be dangerous= . It can easily lead to an unintended violation of the\nrequirements for a = partial equivalence relation. For example, if we kept\nthe above implementa= tion of `PartialEq<Book>` for `BookFormat` and added an\nimplementation of = `PartialEq<Book>` for `Book` (either via a `#[derive]` or\nvia the manual i= mplementation from the first example) then the result would\nviolate transi= tivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,= \n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n = isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq<BookFormat> for Bo= ok {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format = =3D=3D *other\n }\n}\n\nimpl PartialEq<Book> for BookFormat {\n fn eq= (&self, other: &Book) -> bool {\n *self =3D=3D other.format\n }\n= }\n\nfn main() {\n let b1 =3D Book { isbn: 1, format: BookFormat::Paperb= ack };\n let b2 =3D Book { isbn: 2, format: BookFormat::Paperback };\n\n= assert!(b1 =3D=3D BookFormat::Paperback);\n assert!(BookFormat::Pape= rback =3D=3D b2);\n\n // The following should hold by transitivity but d= oesn't.\n assert!(b1 =3D=3D b2); // <-- PANICS\n}\n```\n\n# Examples\n\n= ```rust\nlet x: u32 =3D 0;\nlet y: u32 =3D 1;\n\nassert_eq!(x =3D=3D y, fal= se);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: P= artialEq::ne") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "PartialEq" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "PartialEq") :additionalTextEdits []) (:label "PartialOrd (alias >, <, <=3D, >=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for types that form a [partial order]= (https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and= `ge` methods of this trait can be called using\nthe `<`, `<=3D`, `>`, and = `>=3D` operators, respectively.\n\nThe methods of this trait must be consis= tent with each other and with those of [`PartialEq`].\nThe following condit= ions must hold:\n\n1. `a =3D=3D b` if and only if `partial_cmp(a, b) =3D=3D= Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) =3D=3D Some(Le= ss)`\n3. `a > b` if and only if `partial_cmp(a, b) =3D=3D Some(Greater)`\n4= . `a <=3D b` if and only if `a < b || a =3D=3D b`\n5. `a >=3D b` if and onl= y if `a > b || a =3D=3D b`\n6. `a !=3D b` if and only if `!(a =3D=3D b)`.\n= \nConditions 2=E2=80=935 above are ensured by the default implementation.\n= Condition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also impl= emented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp= ` (see the documentation of that trait for the exact requirements). It's\ne= asy to accidentally make them disagree by deriving some of the traits and m= anually\nimplementing others.\n\nThe comparison relations must satisfy the = following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- *= *Transitivity**: if `A: PartialOrd<B>` and `B: PartialOrd<C>` and `A:\n Pa= rtialOrd<C>`, then `a < b` and `b < c` implies `a < c`. The same must hold = for both `=3D=3D` and `>`.\n This must also work for longer chains, such a= s when `A: PartialOrd<B>`, `B: PartialOrd<C>`,\n `C: PartialOrd<D>`, and `= A: PartialOrd<D>` all exist.\n- **Duality**: if `A: PartialOrd<B>` and `B: = PartialOrd<A>`, then `a < b` if and only if `b > a`.\n\nNote that the `B: P= artialOrd<A>` (dual) and `A: PartialOrd<C>`\n(transitive) impls are not for= ced to exist, but these requirements apply\nwhenever they do exist.\n\nViol= ating these requirements is a logic error. The behavior resulting from a lo= gic error is not\nspecified, but users of the trait must ensure that such l= ogic errors do *not* result in\nundefined behavior. This means that `unsafe= ` code **must not** rely on the correctness of these\nmethods.\n\n## Cross-= crate considerations\n\nUpholding the requirements stated above can become = tricky when one crate implements `PartialOrd`\nfor a type of another crate = (i.e., to allow comparing one of its own types with a type from the\nstanda= rd library). The recommendation is to never implement this trait for a fore= ign type. In\nother words, such a crate should do `impl PartialOrd<ForeignT= ype> for LocalType`, but it should\n*not* do `impl PartialOrd<LocalType> fo= r ForeignType`.\n\nThis avoids the problem of transitive chains that criss-= cross crate boundaries: for all local\ntypes `T`, you may assume that no ot= her crate will add `impl`s that allow comparing `T < U`. In\nother words, i= f other crates add `impl`s that allow building longer transitive chains `U1= < ...\n< T < V1 < ...`, then all the types that appear to the right of `T`= must be types that the crate\ndefining `T` already knows about. This rules= out transitive chains where downstream crates can\nadd new `impl`s that \"= stitch together\" comparisons of foreign types in ways that violate\ntransi= tivity.\n\nNot having such foreign `impl`s also avoids forward compatibilit= y issues where one crate adding\nmore `PartialOrd` implementations can caus= e build failures in downstream crates.\n\n## Corollaries\n\nThe following c= orollaries follow from the above requirements:\n\n- irreflexivity of `<` an= d `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c= ` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) =3D=3D parti= al_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial or= ders\n\nThe `<` and `>` operators behave according to a *strict* partial or= der.\nHowever, `<=3D` and `>=3D` do **not** behave according to a *non-stri= ct*\npartial order.\nThat is because mathematically, a non-strict partial o= rder would require\nreflexivity, i.e. `a <=3D a` would need to be true for = every `a`. This isn't\nalways the case for types that implement `PartialOrd= `, for example:\n\n```rust\nlet a =3D f64::sqrt(-1.0);\nassert_eq!(a <=3D a= , false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\= n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en= .wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bott= om declaration order of the struct's members.\n\nWhen `derive`d on enums, v= ariants are primarily ordered by their discriminants.\nSecondarily, they ar= e ordered by their fields.\nBy default, the discriminant is smallest for va= riants at the top, and\nlargest for variants at the bottom. Here's an examp= le:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n B= ottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting= the discriminants can override this default\nbehavior:\n\n```rust\n#[deriv= e(PartialEq, PartialOrd)]\nenum E {\n Top =3D 2,\n Bottom =3D 1,\n}\n= \nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?= \n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method= , with the others\ngenerated from default implementations.\n\nHowever it re= mains possible to implement the others separately for types which do not ha= ve a\ntotal order. For example, for floating point numbers, `NaN < 0 =3D=3D= false` and `NaN >=3D 0 =3D=3D\nfalse` (cf. IEEE 754-2008 section 5.11).\n\= n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`= Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse = std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n na= me: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn pa= rtial_cmp(&self, other: &Self) -> Option<Ordering> {\n Some(self.cmp= (other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self= ) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl P= artialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n se= lf.height =3D=3D other.height\n }\n}\n```\n\nYou may also find it useful= to use [`partial_cmp`] on your type's fields. Here\nis an example of `Pers= on` types who have a floating-point `height` field that\nis the only field = to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Perso= n {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOr= d for Person {\n fn partial_cmp(&self, other: &Self) -> Option<Ordering>= {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl Partia= lEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.he= ight =3D=3D other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u3= 2 =3D 0;\nlet y: u32 =3D 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y= ), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::c= mp") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "PartialOrd" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "PartialOrd") :additionalTextEdits []) (:label "Result" :kind 13 :detail "Result<{unknown}, {unknown}>" :docu= mentation (:kind "markdown" :value "`Result` is a type that represents either s= uccess ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](sel= f) for details.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Result" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Result") :additionalTextEdits []) (:label "RustcDecodable" :kind 18 :deprecated :json-false :preselect t= :sortText "ffffffef" :filterText "RustcDecodable" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "RustcDecodable") :additionalTextEdits []) (:label "RustcEncodable" :kind 18 :deprecated :json-false :preselect t= :sortText "ffffffef" :filterText "RustcEncodable" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "RustcEncodable") :additionalTextEdits []) (:label "Send" :kind 8 :documentation (:kind "markdown" :value "Types that can be transferred across thread= boundaries.\n\nThis trait is automatically implemented when the compiler d= etermines it's\nappropriate.\n\nAn example of a non-`Send` type is the refe= rence-counting pointer\n[`rc::Rc`][`Rc`]. If two threads attempt to clone [= `Rc`]s that point to the same\nreference-counted value, they might try to u= pdate the reference count at the\nsame time, which is [undefined behavior][= ub] because [`Rc`] doesn't use atomic\noperations. Its cousin [`sync::Arc`]= [arc] does use atomic operations (incurring\nsome overhead) and thus is `Se= nd`.\n\nSee [the Nomicon](../../nomicon/send-and-sync.html) and the [`Sync`= ] trait for more details.\n\n[`Rc`]: ../../std/rc/struct.Rc.html\n[arc]: ..= /../std/sync/struct.Arc.html\n[ub]: ../../reference/behavior-considered-und= efined.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Send" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Send") :additionalTextEdits []) (:label "Sized (alias ?)" :kind 8 :documentation (:kind "markdown" :value "Types with a constant size known at compile= time.\n\nAll type parameters have an implicit bound of `Sized`. The specia= l syntax\n`?Sized` can be used to remove this bound if it's not appropriate= .\n\n```rust\nstruct Foo<T>(T);\nstruct Bar<T: ?Sized>(T);\n\n// struct Foo= Use(Foo<[i32]>); // error: Sized is not implemented for [i32]\nstruct BarUs= e(Bar<[i32]>); // OK\n```\n\nThe one exception is the implicit `Self` type = of a trait. A trait does not\nhave an implicit `Sized` bound as this is inc= ompatible with [trait object]s\nwhere, by definition, the trait needs to wo= rk with all possible implementors,\nand thus could be any size.\n\nAlthough= Rust will let you bind `Sized` to a trait, you won't\nbe able to use it to= form a trait object later:\n\n```rust\ntrait Foo { }\ntrait Bar: Sized { }= \n\nstruct Impl;\nimpl Foo for Impl { }\nimpl Bar for Impl { }\n\nlet x: &d= yn Foo =3D &Impl; // OK\n// let y: &dyn Bar =3D &Impl; // error: the tra= it `Bar` cannot\n // be made into an object\n```= \n\n[trait object]: ../../book/ch17-02-trait-objects.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Sized" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Sized") :additionalTextEdits []) (:label "String" :kind 22 :detail "String" :documentation (:kind "markdown" :value "A UTF-8=E2=80=93encoded, growable string.\n= \n`String` is the most common string type. It has ownership over the conten= ts\nof the string, stored in a heap-allocated buffer (see [Representation](= #representation)).\nIt is closely related to its borrowed counterpart, the = primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a liter= al string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n= \n```rust\nlet hello =3D String::from(\"Hello, world!\");\n```\n\nYou can a= ppend a [`char`] to a `String` with the [`push`] method, and\nappend a [`&s= tr`] with the [`push_str`] method:\n\n```rust\nlet mut hello =3D String::fr= om(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`= push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vecto= r of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`]= method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart =3D vec!= [240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `un= wrap()`.\nlet sparkle_heart =3D String::from_utf8(sparkle_heart).unwrap();\= n\nassert_eq!(\"=F0=9F=92=96\", sparkle_heart);\n```\n\n[`from_utf8`]: Stri= ng::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a= non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the U= TF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are= typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std:= :mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = =3D \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same = contents would be longer because\n// every `char` is four bytes\nlet s =3D = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize =3D s.into_iter().map(|c| mem::= size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII= strings, the difference will be smaller\n// and sometimes they are the sam= e\nlet s =3D \"=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96= \";\nassert_eq!(s.len(), 20);\n\nlet s =3D ['=F0=9F=92=96', '=F0=9F=92=96',= '=F0=9F=92=96', '=F0=9F=92=96', '=F0=9F=92=96'];\nlet size: usize =3D s.in= to_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\= n\nThis raises interesting questions as to how `s[i]` should work.\nWhat sh= ould `i` be here? Several options include byte indices and\n`char` indices = but, because of UTF-8 encoding, only byte indices\nwould provide constant t= ime indexing. Getting the `i`th `char`, for\nexample, is available using [`= chars`]:\n\n```rust\nlet s =3D \"hello\";\nlet third_character =3D s.chars(= ).nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s =3D \"=F0=9F=92= =96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96\";\nlet third_character= =3D s.chars().nth(2);\nassert_eq!(third_character, Some('=F0=9F=92=96'));\= n```\n\nNext, what should `s[i]` return? Because indexing returns a referen= ce\nto underlying data it could be `&u8`, `&[u8]`, or something else simila= r.\nSince we're only providing one index, `&u8` makes the most sense but th= at\nmight not be what the user expects and can be explicitly achieved with\= n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `= 'h'`\nlet s =3D \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nasser= t_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obvio= usly useful\nlet s =3D \"=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96= =F0=9F=92=96\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these amb= iguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```= rust\nlet s =3D \"hello\";\n\n// The following will not compile!\nprintln!(= \"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, = how `&s[i..j]` should work (that is,\nindexing with a range). It should acc= ept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 = encoded. This is also called \"string slicing\".\nNote this will panic if t= he byte indices provided are not character\nboundaries - see [`is_char_boun= dary`] for more details. See the implementations\nfor [`SliceIndex<str>`] f= or more details on string slicing. For a non-panicking\nversion of string s= licing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"= ffi::OsString\"\n[`SliceIndex<str>`]: core::slice::SliceIndex\n[`as_bytes()= `]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_bo= undary\n\nThe [`bytes`] and [`chars`] methods return iterators over the byt= es and\ncodepoints of the string, respectively. To iterate over codepoints = along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[= `chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`St= ring` implements <code>[Deref]<Target =3D [str]></code>, and so inherits al= l of [`str`]'s\nmethods. In addition, this means that you can pass a `Strin= g` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n``= `rust\nfn takes_str(s: &str) { }\n\nlet s =3D String::from(\"Hello\");\n\nt= akes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pas= s it in. This\nconversion is very inexpensive, and so generally, functions = will accept\n[`&str`]s as arguments unless they need a `String` for some sp= ecific\nreason.\n\nIn certain cases Rust doesn't have enough information to= make this\nconversion, known as [`Deref`] coercion. In the following examp= le a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`,= and the function\n`example_func` takes anything that implements the trait.= In this case Rust\nwould need to make two implicit conversions, which Rust= doesn't have the\nmeans to do. For that reason, the following example will= not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample fo= r &'a str {}\n\nfn example_func<A: TraitExample>(example_arg: A) {}\n\nlet = example_string =3D String::from(\"example_string\");\nexample_func(&example= _string);\n```\n\nThere are two options that would work instead. The first = would be to\nchange the line `example_func(&example_string);` to\n`example_= func(example_string.as_str());`, using the method [`as_str()`]\nto explicit= ly extract the string slice containing the string. The second\nway changes = `example_func(&example_string);` to\n`example_func(&*example_string);`. In = this case we are dereferencing a\n`String` to a [`str`], then referencing t= he [`str`] back to\n[`&str`]. The second way is more idiomatic, however bot= h work to do the\nconversion explicitly rather than relying on the implicit= conversion.\n\n# Representation\n\nA `String` is made up of three componen= ts: a pointer to some bytes, a\nlength, and a capacity. The pointer points = to the internal buffer which `String`\nuses to store its data. The length i= s the number of bytes currently stored\nin the buffer, and the capacity is = the size of the buffer in bytes. As such,\nthe length will always be less t= han or equal to the capacity.\n\nThis buffer is always stored on the heap.\= n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nme= thods:\n\n```rust\nuse std::mem;\n\nlet story =3D String::from(\"Once upon = a time...\");\n\n// Prevent automatically dropping the String's data\nlet m= ut story =3D mem::ManuallyDrop::new(story);\n\nlet ptr =3D story.as_mut_ptr= ();\nlet len =3D story.len();\nlet capacity =3D story.capacity();\n\n// sto= ry has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String = out of ptr, len, and capacity. This is all\n// unsafe because we are respon= sible for making sure the components are\n// valid:\nlet s =3D unsafe { Str= ing::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"On= ce upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String:= :len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, = adding elements to it will not\nre-allocate. For example, consider this pro= gram:\n\n```rust\nlet mut s =3D String::new();\n\nprintln!(\"{}\", s.capaci= ty());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\",= s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8= \n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but = as we append to the\nstring, it increases its capacity appropriately. If we= instead use the\n[`with_capacity`] method to allocate the correct capacity= initially:\n\n```rust\nlet mut s =3D String::with_capacity(25);\n\nprintln= !(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n = println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::wit= h_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25= \n25\n25\n```\n\nHere, there's no need to allocate more memory inside the l= oop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@= str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::op= s::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "String" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "String") :additionalTextEdits []) (:label "Sync" :kind 8 :documentation (:kind "markdown" :value "Types for which it is safe to share referen= ces between threads.\n\nThis trait is automatically implemented when the co= mpiler determines\nit's appropriate.\n\nThe precise definition is: a type `= T` is [`Sync`] if and only if `&T` is\n[`Send`]. In other words, if there i= s no possibility of\n[undefined behavior][ub] (including data races) when p= assing\n`&T` references between threads.\n\nAs one would expect, primitive = types like [`u8`] and [`f64`]\nare all [`Sync`], and so are simple aggregat= e types containing them,\nlike tuples, structs and enums. More examples of = basic [`Sync`]\ntypes include \"immutable\" types like `&T`, and those with= simple\ninherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and= \nmost other collection types. (Generic parameters need to be [`Sync`]\nfor= their container to be [`Sync`].)\n\nA somewhat surprising consequence of t= he definition is that `&mut T`\nis `Sync` (if `T` is `Sync`) even though it= seems like that might\nprovide unsynchronized mutation. The trick is that = a mutable\nreference behind a shared reference (that is, `& &mut T`)\nbecom= es read-only, as if it were a `& &T`. Hence there is no risk\nof a data rac= e.\n\nA shorter overview of how [`Sync`] and [`Send`] relate to referencing= :\n* `&T` is [`Send`] if and only if `T` is [`Sync`]\n* `&mut T` is [`Send`= ] if and only if `T` is [`Send`]\n* `&T` and `&mut T` are [`Sync`] if and o= nly if `T` is [`Sync`]\n\nTypes that are not `Sync` are those that have \"i= nterior\nmutability\" in a non-thread-safe form, such as [`Cell`][cell]\nan= d [`RefCell`][refcell]. These types allow for mutation of\ntheir contents e= ven through an immutable, shared reference. For\nexample the `set` method o= n [`Cell<T>`][cell] takes `&self`, so it requires\nonly a shared reference = [`&Cell<T>`][cell]. The method performs no\nsynchronization, thus [`Cell`][= cell] cannot be `Sync`.\n\nAnother example of a non-`Sync` type is the refe= rence-counting\npointer [`Rc`][rc]. Given any reference [`&Rc<T>`][rc], you= can clone\na new [`Rc<T>`][rc], modifying the reference counts in a non-at= omic way.\n\nFor cases when one does need thread-safe interior mutability,\= nRust provides [atomic data types], as well as explicit locking via\n[`sync= ::Mutex`][mutex] and [`sync::RwLock`][rwlock]. These types\nensure that any= mutation cannot cause data races, hence the types\nare `Sync`. Likewise, [= `sync::Arc`][arc] provides a thread-safe\nanalogue of [`Rc`][rc].\n\nAny ty= pes with interior mutability must also use the\n[`cell::UnsafeCell`][unsafe= cell] wrapper around the value(s) which\ncan be mutated through a shared re= ference. Failing to doing this is\n[undefined behavior][ub]. For example, [= `transmute`][transmute]-ing\nfrom `&T` to `&mut T` is invalid.\n\nSee [the = Nomicon][nomicon-send-and-sync] for more details about `Sync`.\n\n[box]: ..= /../std/boxed/struct.Box.html\n[vec]: ../../std/vec/struct.Vec.html\n[cell]= : crate::cell::Cell\n[refcell]: crate::cell::RefCell\n[rc]: ../../std/rc/st= ruct.Rc.html\n[arc]: ../../std/sync/struct.Arc.html\n[atomic data types]: c= rate::sync::atomic\n[mutex]: ../../std/sync/struct.Mutex.html\n[rwlock]: ..= /../std/sync/struct.RwLock.html\n[unsafecell]: crate::cell::UnsafeCell\n[ub= ]: ../../reference/behavior-considered-undefined.html\n[transmute]: crate::= mem::transmute\n[nomicon-send-and-sync]: ../../nomicon/send-and-sync.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Sync" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Sync") :additionalTextEdits []) (:label "ToOwned" :kind 8 :documentation (:kind "markdown" :value "A generalization of `Clone` to borrowed dat= a.\n\nSome types make it possible to go from borrowed to owned, usually by\= nimplementing the `Clone` trait. But `Clone` works only for going from `&T`= \nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\n= from any borrow of a given type.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ToOwned" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ToOwned") :additionalTextEdits []) (:label "ToString" :kind 8 :documentation (:kind "markdown" :value "A trait for converting a value to a `String= `.\n\nThis trait is automatically implemented for any type which implements= the\n[`Display`] trait. As such, `ToString` shouldn't be implemented direc= tly:\n[`Display`] should be implemented instead, and you get the `ToString`= \nimplementation for free.\n\n[`Display`]: fmt::Display") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ToString" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ToString") :additionalTextEdits []) (:label "TryFrom" :kind 8 :documentation (:kind "markdown" :value "Simple and safe type conversions that may f= ail in a controlled\nway under some circumstances. It is the reciprocal of = [`TryInto`].\n\nThis is useful when you are doing a type conversion that ma= y\ntrivially succeed but may also need special handling.\nFor example, ther= e is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait= , because an [`i64`] may contain a value\nthat an [`i32`] cannot represent = and so the conversion would lose data.\nThis might be handled by truncating= the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some= other method. The [`From`]\ntrait is intended for perfect conversions, so= the `TryFrom` trait\ninforms the programmer when a type conversion could g= o bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\= n\n- `TryFrom<T> for U` implies [`TryInto`]`<U> for T`\n- [`try_from`] is r= eflexive, which means that `TryFrom<T> for T`\nis implemented and cannot fa= il -- the associated `Error` type for\ncalling `T::try_from()` on a value o= f type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallib= le`] and [`!`] will be\nequivalent.\n\n`TryFrom<T>` can be implemented as f= ollows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom<i32> for G= reaterThanZero {\n type Error =3D &'static str;\n\n fn try_from(value= : i32) -> Result<Self, Self::Error> {\n if value <=3D 0 {\n = Err(\"GreaterThanZero only accepts values greater than zero!\")\n = } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```= \n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\= n```rust\nlet big_number =3D 1_000_000_000_000i64;\n// Silently truncates `= big_number`, requires detecting\n// and handling the truncation after the f= act.\nlet smaller_number =3D big_number as i32;\nassert_eq!(smaller_number,= -727379968);\n\n// Returns an error because `big_number` is too big to\n//= fit in an `i32`.\nlet try_smaller_number =3D i32::try_from(big_number);\na= ssert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_succes= sful_smaller_number =3D i32::try_from(3);\nassert!(try_successful_smaller_n= umber.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "TryFrom" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "TryFrom") :additionalTextEdits []) (:label "TryInto" :kind 8 :documentation (:kind "markdown" :value "An attempted conversion that consumes `self= `, which may or may not be\nexpensive.\n\nLibrary authors should usually no= t directly implement this trait,\nbut should prefer implementing the [`TryF= rom`] trait, which offers\ngreater flexibility and provides an equivalent `= TryInto`\nimplementation for free, thanks to a blanket implementation in th= e\nstandard library. For more information on this, see the\ndocumentation f= or [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restricti= ons and reasoning as implementing\n[`Into`], see there for details.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "TryInto" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "TryInto") :additionalTextEdits []) (:label "Unpin" :kind 8 :documentation (:kind "markdown" :value "Types that do not require any pinning guara= ntees.\n\nFor information on what \"pinning\" is, see the [`pin` module] do= cumentation.\n\nImplementing the `Unpin` trait for `T` expresses the fact t= hat `T` is pinning-agnostic:\nit shall not expose nor rely on any pinning g= uarantees. This, in turn, means that a\n`Pin`-wrapped pointer to such a typ= e can feature a *fully unrestricted* API.\nIn other words, if `T: Unpin`, a= value of type `T` will *not* be bound by the invariants\nwhich pinning oth= erwise offers, even when \"pinned\" by a [`Pin<Ptr>`] pointing at it.\nWhen= a value of type `T` is pointed at by a [`Pin<Ptr>`], [`Pin`] will not rest= rict access\nto the pointee value like it normally would, thus allowing the= user to do anything that they\nnormally could with a non-[`Pin`]-wrapped `= Ptr` to that value.\n\nThe idea of this trait is to alleviate the reduced e= rgonomics of APIs that require the use\nof [`Pin`] for soundness for some t= ypes, but which also want to be used by other types that\ndon't care about = pinning. The prime example of such an API is [`Future::poll`]. There are ma= ny\n[`Future`] types that don't care about pinning. These futures can imple= ment `Unpin` and\ntherefore get around the pinning related restrictions in = the API, while still allowing the\nsubset of [`Future`]s which *do* require= pinning to be implemented soundly.\n\nFor more discussion on the consequen= ces of [`Unpin`] within the wider scope of the pinning\nsystem, see the [se= ction about `Unpin`] in the [`pin` module].\n\n`Unpin` has no consequence a= t all for non-pinned data. In particular, [`mem::replace`] happily\nmoves `= !Unpin` data, which would be immovable when pinned ([`mem::replace`] works = for any\n`&mut T`, not just when `T: Unpin`).\n\n*However*, you cannot use = [`mem::replace`] on `!Unpin` data which is *pinned* by being wrapped\ninsid= e a [`Pin<Ptr>`] pointing at it. This is because you cannot (safely) use a\= n[`Pin<Ptr>`] to get an `&mut T` to its pointee value, which you would need= to call\n[`mem::replace`], and *that* is what makes this system work.\n\nS= o this, for example, can only be done on types implementing `Unpin`:\n\n```= rust\nuse std::mem;\nuse std::pin::Pin;\n\nlet mut string =3D \"this\".to_s= tring();\nlet mut pinned_string =3D Pin::new(&mut string);\n\n// We need a = mutable reference to call `mem::replace`.\n// We can obtain such a referenc= e by (implicitly) invoking `Pin::deref_mut`,\n// but that is only possible = because `String` implements `Unpin`.\nmem::replace(&mut *pinned_string, \"o= ther\".to_string());\n```\n\nThis trait is automatically implemented for al= most every type. The compiler is free\nto take the conservative stance of m= arking types as [`Unpin`] so long as all of the types that\ncompose its fie= lds are also [`Unpin`]. This is because if a type implements [`Unpin`], the= n it\nis unsound for that type's implementation to rely on pinning-related = guarantees for soundness,\n*even* when viewed through a \"pinning\" pointer= ! It is the responsibility of the implementor of\na type that relies upon p= inning for soundness to ensure that type is *not* marked as [`Unpin`]\nby a= dding [`PhantomPinned`] field. For more details, see the [`pin` module] doc= s.\n\n[`mem::replace`]: crate::mem::replace \"mem replace\"\n[`Future`]: cr= ate::future::Future \"Future\"\n[`Future::poll`]: crate::future::Future::po= ll \"Future poll\"\n[`Pin`]: crate::pin::Pin \"Pin\"\n[`Pin<Ptr>`]: crate::= pin::Pin \"Pin\"\n[`pin` module]: crate::pin \"pin module\"\n[section about= `Unpin`]: crate::pin#unpin \"pin module docs about unpin\"\n[`unsafe`]: ..= /../std/keyword.unsafe.html \"keyword unsafe\"") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Unpin" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Unpin") :additionalTextEdits []) (:label "Vec" :kind 22 :detail "Vec<{unknown}, {unknown}>" :documentat= ion (:kind "markdown" :value "A contiguous growable array type, written a= s `Vec<T>`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec =3D V= ec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert= _eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), = 1);\n\nvec[0] =3D 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nf= or x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n= ```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```= rust\nlet mut vec1 =3D vec![1, 2, 3];\nvec1.push(4);\nlet vec2 =3D Vec::fro= m([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize ea= ch element of a `Vec<T>` with a given value.\nThis may be more efficient th= an performing allocation and initialization\nin separate steps, especially = when initializing a vector of zeros:\n\n```rust\nlet vec =3D vec![0; 5];\na= ssert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but pot= entially slower:\nlet mut vec =3D Vec::with_capacity(5);\nvec.resize(5, 0);= \nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Cap= acity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec<T>` as a= n efficient stack:\n\n```rust\nlet mut stack =3D Vec::new();\n\nstack.push(= 1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) =3D stack.pop() = {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\= nThe `Vec` type allows access to values by index, because it implements the= \n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v =3D = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nH= owever be careful: if you try to access an index which isn't in the `Vec`,\= nyour software will panic! You cannot do this:\n\n```rust\nlet v =3D vec![0= , 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] = and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\= n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-on= ly objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\n= fn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v =3D vec![0, 1];\nr= ead_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\= nlet u: &[usize] =3D &v;\n// or like this:\nlet u: &[_] =3D &v;\n```\n\nIn = Rust, it's more common to pass slices as arguments rather than vectors\nwhe= n you just want to provide read access. The same goes for [`String`] and\n[= `&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the = amount of space allocated for any future\nelements that will be added onto = the vector. This is not to be confused with\nthe *length* of a vector, whic= h specifies the number of actual elements\nwithin the vector. If a vector's= length exceeds its capacity, its capacity\nwill automatically be increased= , but its elements will have to be\nreallocated.\n\nFor example, a vector w= ith capacity 10 and length 0 would be an empty vector\nwith space for 10 mo= re elements. Pushing 10 or fewer elements onto the\nvector will not change = its capacity or cause reallocation to occur. However,\nif the vector's leng= th is increased to 11, it will have to reallocate, which\ncan be slow. For = this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever poss= ible to specify how big the vector is expected to get.\n\n# Guarantees\n\nD= ue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\na= bout its design. This ensures that it's as low-overhead as possible in\nthe= general case, and can be correctly manipulated in primitive ways\nby unsaf= e code. Note that these guarantees refer to an unqualified `Vec<T>`.\nIf ad= ditional type parameters are added (e.g., to support custom allocators),\no= verriding their defaults may change the behavior.\n\nMost fundamentally, `V= ec` is and always will be a (pointer, capacity, length)\ntriplet. No more, = no less. The order of these fields is completely\nunspecified, and you shou= ld use the appropriate methods to modify these.\nThe pointer will never be = null, so this type is null-pointer-optimized.\n\nHowever, the pointer might= not actually point to allocated memory. In particular,\nif you construct a= `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_c= apacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an = empty Vec, it will not allocate memory. Similarly, if you store zero-sized\= ntypes inside a `Vec`, it will not allocate space for them. *Note that in t= his case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will alloc= ate if and only\nif <code>[mem::size_of::\\<T>]\\() * [capacity]\\() > 0</c= ode>. In general, `Vec`'s allocation\ndetails are very subtle --- if you in= tend to allocate memory using a `Vec`\nand use it for something else (eithe= r to pass to unsafe code, or to build your\nown memory-backed collection), = be sure to deallocate this memory by using\n`from_raw_parts` to recover the= `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the= memory it points to is on the heap\n(as defined by the allocator Rust is c= onfigured to use by default), and its\npointer points to [`len`] initialize= d, contiguous elements in order (what\nyou would see if you coerced it to a= slice), followed by <code>[capacity] - [len]</code>\nlogically uninitializ= ed, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'= ` with capacity 4 can be\nvisualized as below. The top part is the `Vec` st= ruct, it contains a\npointer to the head of the allocation in the heap, len= gth and capacity.\nThe bottom part is the allocation on the heap, a contigu= ous memory block.\n\n```text\n ptr len capacity\n +-= -------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--= ------+--------+--------+\n |\n v\nHeap +--------+-= -------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n = +--------+--------+--------+--------+\n```\n\n- **uninit** represents= memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is n= ot stable and `Vec` makes no guarantees about its memory\n layout (includi= ng the order of fields).\n\n`Vec` will never perform a \"small optimization= \" where elements are actually\nstored on the stack for two reasons:\n\n* I= t would make it more difficult for unsafe code to correctly manipulate\n a= `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n= only moved, and it would be more difficult to determine if a `Vec` had\n = actually allocated memory.\n\n* It would penalize the general case, incurr= ing an additional branch\n on every access.\n\n`Vec` will never automatica= lly shrink itself, even if completely empty. This\nensures no unnecessary a= llocations or deallocations occur. Emptying a `Vec`\nand then filling it ba= ck up to the same [`len`] should incur no calls to\nthe allocator. If you w= ish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[= `push`] and [`insert`] will never (re)allocate if the reported capacity is\= nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n<code>[len] = =3D=3D [capacity]</code>. That is, the reported capacity is completely\nacc= urate, and can be relied on. It can even be used to manually free the memor= y\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate= , even\nwhen not necessary.\n\n`Vec` does not guarantee any particular grow= th strategy when reallocating\nwhen full, nor when [`reserve`] is called. T= he current strategy is basic\nand it may prove desirable to use a non-const= ant growth factor. Whatever\nstrategy is used will of course guarantee *O*(= 1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::wit= h_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith at le= ast the requested capacity. If <code>[len] =3D=3D [capacity]</code>,\n(as i= s the case for the [`vec!`] macro), then a `Vec<T>` can be converted to\nan= d from a [`Box<[T]>`][owned slice] without reallocating or moving the eleme= nts.\n\n`Vec` will not specifically overwrite any data that is removed from= it,\nbut also won't specifically preserve it. Its uninitialized memory is\= nscratch space that it may use however it wants. It will generally just do\= nwhatever is most efficient or otherwise easy to implement. Do not rely on\= nremoved data to be erased for security purposes. Even if you drop a `Vec`,= its\nbuffer may simply be reused by another allocation. Even if you zero a= `Vec`'s memory\nfirst, that might not actually happen because the optimize= r does not consider\nthis a side-effect that must be preserved. There is on= e case which we will\nnot break, however: using `unsafe` code to write to t= he excess capacity,\nand then increasing the length to match, is always val= id.\n\nCurrently, `Vec` does not guarantee the order in which elements are = dropped.\nThe order has changed in the past and may change again.\n\n[`get`= ]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::Stri= ng\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`= ]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n= [mem::size_of::\\<T>]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::l= en\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve= \n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Vec" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Vec") :additionalTextEdits []) (:label "alloc_error_handler" :kind 18 :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "alloc_error_handler" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "alloc_error_handler") :additionalTextEdits [])])) [client-request] (id:13) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 13 :method "completionItem/resolve" :params (:label #("HashSet (use std::collections::HashSet)" 0 1 (eglot--lsp-item #1)) :kind 22 :detail "HashSet<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` where= the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires t= hat the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freque= ntly be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you impleme= nt these yourself,\nit is important that the following property holds:\n\n`= ``text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, if= two keys are equal, their hashes must be equal.\nViolating this property i= s a logic error.\n\nIt is also a logic error for a key to be modified in su= ch a way that the key's\nhash, as determined by the [`Hash`] trait, or its = equality, as determined by\nthe [`Eq`] trait, changes while it is in the ma= p. This is normally only\npossible through [`Cell`], [`RefCell`], global st= ate, I/O, or unsafe code.\n\nThe behavior resulting from either logic error= is not specified, but will\nbe encapsulated to the `HashSet` that observed= the logic error and not\nresult in undefined behavior. This could include = panics, incorrect results,\naborts, memory leaks, and non-termination.\n\n#= Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference let= s us omit an explicit type signature (which\n// would be `HashSet<String>` = in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books.\= nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To Kil= l a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string());= \nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a specifi= c one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We ha= ve {} books, but The Winds of Winter ain't one.\",\n books.len(= ));\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate o= ver everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\n\= nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`] a= nd [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`Eq`= ] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a known= list of items can be initialized from an array:\n\n```rust\nuse std::colle= ctions::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\"= , \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-variant-= of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`RefC= ell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :tex= tEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [] :data (:position (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17)) :imports [(:full_import_path "std::collections::HashSet" :imported_name "HashSe= t")] :version 0))) [server-reply] (id:13) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 13 :result (:label "HashSet (use std::collections::HashSet)" :kind 22 :detail "Hash= Set<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` where= the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires t= hat the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freque= ntly be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you impleme= nt these yourself,\nit is important that the following property holds:\n\n`= ``text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, if= two keys are equal, their hashes must be equal.\nViolating this property i= s a logic error.\n\nIt is also a logic error for a key to be modified in su= ch a way that the key's\nhash, as determined by the [`Hash`] trait, or its = equality, as determined by\nthe [`Eq`] trait, changes while it is in the ma= p. This is normally only\npossible through [`Cell`], [`RefCell`], global st= ate, I/O, or unsafe code.\n\nThe behavior resulting from either logic error= is not specified, but will\nbe encapsulated to the `HashSet` that observed= the logic error and not\nresult in undefined behavior. This could include = panics, incorrect results,\naborts, memory leaks, and non-termination.\n\n#= Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference let= s us omit an explicit type signature (which\n// would be `HashSet<String>` = in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books.\= nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To Kil= l a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string());= \nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a specifi= c one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We ha= ve {} books, but The Winds of Winter ain't one.\",\n books.len(= ));\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate o= ver everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\n\= nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`] a= nd [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`Eq`= ] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a known= list of items can be initialized from an array:\n\n```rust\nuse std::colle= ctions::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\"= , \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-variant-= of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`RefC= ell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :tex= tEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [(:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :newText "use std::collections::HashSet;\n\n")])) [client-notification] Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :method "textDocument/didChange" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs" :version 5) :contentChanges [(:range (:start (:line 4 :character 17) :end (:line 4 :character 17)) :rangeLength 0 :text " (use std::collections::HashSet)") (:range (:start (:line 4 :character 17) :end (:line 4 :character 49)) :rangeLength 32 :text "") (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :rangeLength 7 :text "") (:range (:start (:line 4 :character 10) :end (:line 4 :character 10)) :rangeLength 0 :text "HashSet") (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :rangeLength 0 :text "use std::collections::HashSet;\n\n")])) [client-request] (id:14) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 14 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:15) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 15 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:16) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 16 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-notification] Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :method "workspace/didChangeWatchedFiles" :params (:changes [(:uri "file:///home/brennan/test_rust/src/brennan@HIDDEN%3A172= 6418014" :type 1)])) [server-reply] (id:14) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 14 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:16) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 16 :result [(:range (:start (:line 0 :character 22) :end (:line 0 :character 29))) (:range (:start (:line 6 :character 10) :end (:line 6 :character 17)))]) [server-reply] (id:15) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 15 :result (:contents (:kind "plaintext" :value "std::collections::hash::set\n\npub struct Ha= shSet<T, S =3D RandomState> {\n base: {unknown},\n}\n\n\nA [hash set] im= plemented as a HashMap where the value is ().\n\nAs with the [HashMap] type= , a HashSet requires that the elements implement the Eq and Hash traits. Th= is can frequently be achieved by using #[derive(PartialEq, Eq, Hash)]. If y= ou implement these yourself, it is important that the following property ho= lds:\n\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n\nIn other words, if two = keys are equal, their hashes must be equal. Violating this property is a lo= gic error.\n\nIt is also a logic error for a key to be modified in such a w= ay that the key's hash, as determined by the Hash trait, or its equality, a= s determined by the Eq trait, changes while it is in the map. This is norma= lly only possible through [Cell], [RefCell], global state, I/O, or unsafe c= ode.\n\nThe behavior resulting from either logic error is not specified, bu= t will be encapsulated to the HashSet that observed the logic error and not= result in undefined behavior. This could include panics, incorrect results= , aborts, memory leaks, and non-termination.\n\nExamplesuse std::collection= s::HashSet;\n// Type inference lets us omit an explicit type signature (whi= ch\n// would be `HashSet<String>` in this example).\nlet mut books =3D Hash= Set::new();\n\n// Add some books.\nbooks.insert(\"A Dance With Dragons\".to= _string());\nbooks.insert(\"To Kill a Mockingbird\".to_string());\nbooks.in= sert(\"The Odyssey\".to_string());\nbooks.insert(\"The Great Gatsby\".to_st= ring());\n\n// Check for a specific one.\nif !books.contains(\"The Winds of= Winter\") {\n println!(\"We have {} books, but The Winds of Winter ain'= t one.\",\n books.len());\n}\n\n// Remove a book.\nbooks.remove= (\"The Odyssey\");\n\n// Iterate over everything.\nfor book in &books {\n = println!(\"{book}\");\n}\n\nThe easiest way to use HashSet with a custom = type is to derive Eq and Hash. We must also derive PartialEq, which is requ= ired if Eq is derived.\n\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n\nA HashSet with a known list o= f items can be initialized from an array:\n\nuse std::collections::HashSet;= \n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\", \"Harald\"]);") :range (:start (:line 6 :character 10) :end (:line 6 :character 17)))) [client-request] (id:17) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 17 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:18) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 18 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:19) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 19 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:20) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 20 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :range (:start (:line 0 :character 0) :end (:line 10 :character 0)))) [server-reply] (id:17) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 17 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:18) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 18 :result (:contents (:kind "plaintext" :value "std::collections::hash::set\n\npub struct Ha= shSet<T, S =3D RandomState> {\n base: {unknown},\n}\n\n\nA [hash set] im= plemented as a HashMap where the value is ().\n\nAs with the [HashMap] type= , a HashSet requires that the elements implement the Eq and Hash traits. Th= is can frequently be achieved by using #[derive(PartialEq, Eq, Hash)]. If y= ou implement these yourself, it is important that the following property ho= lds:\n\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n\nIn other words, if two = keys are equal, their hashes must be equal. Violating this property is a lo= gic error.\n\nIt is also a logic error for a key to be modified in such a w= ay that the key's hash, as determined by the Hash trait, or its equality, a= s determined by the Eq trait, changes while it is in the map. This is norma= lly only possible through [Cell], [RefCell], global state, I/O, or unsafe c= ode.\n\nThe behavior resulting from either logic error is not specified, bu= t will be encapsulated to the HashSet that observed the logic error and not= result in undefined behavior. This could include panics, incorrect results= , aborts, memory leaks, and non-termination.\n\nExamplesuse std::collection= s::HashSet;\n// Type inference lets us omit an explicit type signature (whi= ch\n// would be `HashSet<String>` in this example).\nlet mut books =3D Hash= Set::new();\n\n// Add some books.\nbooks.insert(\"A Dance With Dragons\".to= _string());\nbooks.insert(\"To Kill a Mockingbird\".to_string());\nbooks.in= sert(\"The Odyssey\".to_string());\nbooks.insert(\"The Great Gatsby\".to_st= ring());\n\n// Check for a specific one.\nif !books.contains(\"The Winds of= Winter\") {\n println!(\"We have {} books, but The Winds of Winter ain'= t one.\",\n books.len());\n}\n\n// Remove a book.\nbooks.remove= (\"The Odyssey\");\n\n// Iterate over everything.\nfor book in &books {\n = println!(\"{book}\");\n}\n\nThe easiest way to use HashSet with a custom = type is to derive Eq and Hash. We must also derive PartialEq, which is requ= ired if Eq is derived.\n\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n\nA HashSet with a known list o= f items can be initialized from an array:\n\nuse std::collections::HashSet;= \n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\", \"Harald\"]);") :range (:start (:line 6 :character 10) :end (:line 6 :character 17)))) [server-reply] (id:19) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 19 :result [(:range (:start (:line 0 :character 22) :end (:line 0 :character 29))) (:range (:start (:line 6 :character 10) :end (:line 6 :character 17)))]) [server-reply] (id:20) Mon Sep 16 12:52:59 2024: (:jsonrpc "2.0" :id 20 :result []) [client-request] (id:21) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 21 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:22) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 22 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [client-request] (id:23) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 23 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 6 :character 17))) [server-reply] (id:21) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 21 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:23) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 23 :result [(:range (:start (:line 0 :character 22) :end (:line 0 :character 29))) (:range (:start (:line 6 :character 10) :end (:line 6 :character 17)))]) [server-reply] (id:22) Mon Sep 16 12:53:02 2024: (:jsonrpc "2.0" :id 22 :result (:contents (:kind "plaintext" :value "std::collections::hash::set\n\npub struct Ha= shSet<T, S =3D RandomState> {\n base: {unknown},\n}\n\n\nA [hash set] im= plemented as a HashMap where the value is ().\n\nAs with the [HashMap] type= , a HashSet requires that the elements implement the Eq and Hash traits. Th= is can frequently be achieved by using #[derive(PartialEq, Eq, Hash)]. If y= ou implement these yourself, it is important that the following property ho= lds:\n\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n\nIn other words, if two = keys are equal, their hashes must be equal. Violating this property is a lo= gic error.\n\nIt is also a logic error for a key to be modified in such a w= ay that the key's hash, as determined by the Hash trait, or its equality, a= s determined by the Eq trait, changes while it is in the map. This is norma= lly only possible through [Cell], [RefCell], global state, I/O, or unsafe c= ode.\n\nThe behavior resulting from either logic error is not specified, bu= t will be encapsulated to the HashSet that observed the logic error and not= result in undefined behavior. This could include panics, incorrect results= , aborts, memory leaks, and non-termination.\n\nExamplesuse std::collection= s::HashSet;\n// Type inference lets us omit an explicit type signature (whi= ch\n// would be `HashSet<String>` in this example).\nlet mut books =3D Hash= Set::new();\n\n// Add some books.\nbooks.insert(\"A Dance With Dragons\".to= _string());\nbooks.insert(\"To Kill a Mockingbird\".to_string());\nbooks.in= sert(\"The Odyssey\".to_string());\nbooks.insert(\"The Great Gatsby\".to_st= ring());\n\n// Check for a specific one.\nif !books.contains(\"The Winds of= Winter\") {\n println!(\"We have {} books, but The Winds of Winter ain'= t one.\",\n books.len());\n}\n\n// Remove a book.\nbooks.remove= (\"The Odyssey\");\n\n// Iterate over everything.\nfor book in &books {\n = println!(\"{book}\");\n}\n\nThe easiest way to use HashSet with a custom = type is to derive Eq and Hash. We must also derive PartialEq, which is requ= ired if Eq is derived.\n\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n\nA HashSet with a known list o= f items can be initialized from an array:\n\nuse std::collections::HashSet;= \n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\", \"Harald\"]);") :range (:start (:line 6 :character 10) :end (:line 6 :character 17)))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=AFTER Content-Transfer-Encoding: quoted-printable Content-Description: After a8c1559 [internal] Mon Sep 16 12:50:03 2024: (:message "Running language server: rust-analyzer") [client-request] (id:1) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 1 :method "initialize" :params (:processId 1664968 :clientInfo (:name "Eglot") :rootPath "/home/brennan/test_rust/" :rootUri "file:///home/brennan= /test_rust" :initializationOptions #s(hash-table size 1 test eql rehash-siz= e 1.5 rehash-threshold 0.8125 data ()) :capabilities (:workspace (:applyEdit t :executeCommand (:dynamicRegistration :json-false) :workspaceEdit (:documentChanges t) :didChangeWatchedFiles (:dynamicRegistration t) :symbol (:dynamicRegistration :json-false) :configuration t :workspaceFolders t) :textDocument (:synchronization (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didS= ave t) :completion (:dynamicRegistration :json-false :completionItem (:snippetSupport :json-false :deprecatedSupport t :resolveSupport (:properties ["documentation" "details" "additionalTextEdits"]) :tagSupport (:valueSet [1])) :contextSupport t) :hover (:dynamicRegistration :json-false :contentFormat ["plaintext"]) :signatureHelp (:dynamicRegistration :json-false :signatureInformation (:parameterInformation (:labelOffsetSupport t) :activeParameterSupport t)) :references (:dynamicRegistration :json-false) :definition (:dynamicRegistration :json-false :linkSupport t) :declaration (:dynamicRegistration :json-false :linkSupport t) :implementation (:dynamicRegistration :json-false :linkSupport t) :typeDefinition (:dynamicRegistration :json-false :linkSupport t) :documentSymbol (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t := symbolKind (:valueSet [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24= 25 26])) :documentHighlight (:dynamicRegistration :json-false) :codeAction (:dynamicRegistration :json-false :codeActionLiteralSupport (:codeActionKind (:valueSet ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor= .rewrite" "source" "source.organizeImports"])) :isPreferredSupport t) :formatting (:dynamicRegistration :json-false) :rangeFormatting (:dynamicRegistration :json-false) :rename (:dynamicRegistration :json-false) :inlayHint (:dynamicRegistration :json-false) :publishDiagnostics (:relatedInformation :json-false :codeDescriptionSupport :json-false :ta= gSupport (:valueSet [1 2]))) :window (:workDoneProgress t) :general (:positionEncodings ["utf-32" "utf-8" "utf-16"]) :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash= -threshold 0.8125 data ())) :workspaceFolders [(:uri "file:///home/brennan/test_rust" :name "~/test_rust/")])) [server-reply] (id:1) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 1 :result (:capabilities (:positionEncoding "utf-32" :textDocumentSync (:openClose t :change 2 :save nil) :selectionRangeProvider t :hoverProvider t :completionProvider (:resolveProvider t :triggerCharacters [":" "." "'" "("] :completionItem (:labelDetailsSupport :json-false)) :signatureHelpProvider (:triggerCharacters ["(" "," "<"]) :definitionProvider t :typeDefinitionProvider t :implementationPro= vider t :referencesProvider t :documentHighlightProvider t :documentSymbolP= rovider t :workspaceSymbolProvider t :codeActionProvider (:codeActionKinds ["" "quickfix" "refactor" "refactor.extract" "refactor.inline" "r= efactor.rewrite"] :resolveProvider t) :codeLensProvider (:resolveProvider t) :documentFormattingProvider t :documentRangeFormattingProvider :js= on-false :documentOnTypeFormattingProvider (:firstTriggerCharacter "=3D" :moreTriggerCharacter ["." ">" "{" "("]) :renameProvider (:prepareProvider t) :foldingRangeProvider t :declarationProvider t :workspace (:workspaceFolders (:supported t :changeNotifications t) :fileOperations (:willRename (:filters [(:scheme "file" :pattern (:glob "**/*.rs" :matches "file")) (:scheme "file" :pattern (:glob "**" :matches "folder"))]))) :callHierarchyProvider t :semanticTokensProvider (:legend (:tokenTypes ["comment" "decorator" "enumMember" "enum" "function" "interface" "keyw= ord" "macro" "method" "namespace" "number" "operator" "parameter" "property= " "string" "struct" "typeParameter" "variable" "angle" "arithmetic" "attrib= uteBracket" "attribute" "bitwise" "boolean" "brace" "bracket" "builtinAttri= bute" "builtinType" "character" "colon" "comma" "comparison" "constParamete= r" "const" "deriveHelper" "derive" "dot" "escapeSequence" "formatSpecifier"= "generic" "invalidEscapeSequence" "label" "lifetime" "logical" "macroBang"= "parenthesis" "procMacro" "punctuation" "selfKeyword" "selfTypeKeyword" "s= emicolon" "static" "toolModule" "typeAlias" "union" "unresolvedReference"] :tokenModifiers ["async" "documentation" "declaration" "static" "defaultLibrary" "assoc= iated" "attribute" "callable" "constant" "consuming" "controlFlow" "crateRo= ot" "injected" "intraDocLink" "library" "macro" "mutable" "procMacro" "publ= ic" "reference" "trait" "unsafe"]) :range t :full (:delta t)) :inlayHintProvider (:resolveProvider t) :experimental (:externalDocs t :hoverRange t :joinLines t :matchingBrace t :move= Item t :onEnter t :openCargoToml t :parentModule t :runnables (:kinds ["cargo"]) :ssr t :workspaceSymbolScopeKindFiltering t)) :serverInfo (:name "rust-analyzer" :version "1.81.0 (eeb90cda 2024-09-04)"))) [client-notification] Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql= rehash-size 1.5 rehash-threshold 0.8125 data ())) [client-notification] Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :method "textDocument/didOpen" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs" :version 0 :language= Id "rust-ts" :text "struct S<T> {\n x: T\n}\n\nimpl<T> S<HashSet<T>> {\n= }\n\nfn main() {}\n"))) [client-notification] Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshol= d 0.8125 data ()))) [client-request] (id:2) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 2 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :range (:start (:line 0 :character 0) :end (:line 8 :character 0)))) [server-request] (id:0) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 0 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:0) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 0 :result nil) [server-notification] Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-request] (id:1) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params (:items [(:section "rust-analyzer")])) [client-reply] (id:1) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 1 :result [nil]) [server-reply] (id:2) Mon Sep 16 12:50:03 2024: (:jsonrpc "2.0" :id 2 :result []) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-request] (id:2) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 2 :method "client/registerCapability" :params (:registrations [(:id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWat= chedFiles" :registerOptions (:watchers [(:globPattern "/home/brennan/test_rust/**/*.rs") (:globPattern "/home/brennan/test_rust/**/Cargo.{toml,lock}") (:globPattern "/home/brennan/test_rust/**/rust-analyzer.toml") (:globPattern "/home/brennan/.config/rust-analyzer/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/Cargo.toml")]))])) [client-reply] (id:2) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 2 :result nil) [server-request] (id:3) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 3 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:3) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 3 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:4) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 4 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Roots Scanned")) [client-reply] (id:4) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 4 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "begin" :title "Roots Scanned" :cancellable :json-false :message= "0/3" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/alloc" :percentage 0))) [server-request] (id:5) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 5 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:5) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 5 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/core" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/backtrace" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_abort" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_unwind" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/portable-simd" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/proc_macro" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/profiler_builtins" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rtstartup" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-alloc" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-core" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-std" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/std" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/stdarch" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/sysroot" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/test" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/unwind" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3" :percentage 33)= )) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: src" :percentag= e 33))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "2/3" :percentage 66)= )) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "end" :message "3/3"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:6) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 6 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Fetching")) [client-reply] (id:6) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 6 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "begin" :title "Fetching" :cancellable :json-false))) [server-request] (id:7) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 7 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:7) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 7 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [] :version 0)) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "0/1 (test_rust)" :pe= rcentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:8) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 8 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:8) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 8 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "report" :cancellable :json-false :message "metadata"))) [server-request] (id:9) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 9 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:9) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 9 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Fetching" :value (:kind "end"))) [server-request] (id:10) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 10 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building build-artifacts")) [client-reply] (id:10) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 10 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "begin" :title "Building build-artifacts" :cancellable :json-fal= se))) [server-request] (id:11) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 11 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:11) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 11 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-request] (id:12) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 12 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Loading proc-macros")) [client-reply] (id:12) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 12 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "begin" :title "Loading proc-macros" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:13) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 13 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:13) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 13 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "1/12 (core + 6 more)= " :percentage 8))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "3/12 (core + 4 more)= " :percentage 25))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "4/12 (core + 3 more)= " :percentage 33))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "5/12 (core + 2 more)= " :percentage 41))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "6/12 (core + 1 more)= " :percentage 50))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "7/12 (core)" :percen= tage 58))) [client-request] (id:3) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 3 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [client-request] (id:4) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 4 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [client-request] (id:5) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 5 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 0 :character 0))) [server-request] (id:14) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 14 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:14) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 14 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "report" :cancellable :json-false :message "building proc-macros= : test_rust"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "report" :cancellable :json-false :message "building proc-macros= : test_rust"))) [server-request] (id:15) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 15 :method "client/registerCapability" :params (:registrations [(:id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWat= chedFiles" :registerOptions (:watchers [(:globPattern "/home/brennan/test_rust/**/*.rs") (:globPattern "/home/brennan/test_rust/**/Cargo.{toml,lock}") (:globPattern "/home/brennan/test_rust/**/rust-analyzer.toml") (:globPattern "/home/brennan/.config/rust-analyzer/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/rust-analyzer.toml") (:globPattern "/home/brennan/test_rust/Cargo.toml")]))])) [client-reply] (id:15) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 15 :result nil) [server-request] (id:16) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 16 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Building CrateGraph")) [client-reply] (id:16) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 16 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "begin" :title "Building CrateGraph" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building CrateGraph" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Building build-artifacts" :value (:kind "end"))) [server-reply] (id:3) ERROR Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 3 :error (:code -32801 :message "content modified")) [internal] (id:3) ERROR Mon Sep 16 12:50:04 2024: (:message "error ignored, status set (content modified)" :id 3 :error -3280= 1) [server-reply] (id:4) ERROR Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 4 :error (:code -32801 :message "content modified")) [internal] (id:4) ERROR Mon Sep 16 12:50:04 2024: (:message "error ignored, status set (content modified)" :id 4 :error -3280= 1) [server-reply] (id:5) ERROR Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 5 :error (:code -32801 :message "content modified")) [internal] (id:5) ERROR Mon Sep 16 12:50:04 2024: (:message "error ignored, status set (content modified)" :id 5 :error -3280= 1) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:17) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 17 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Loading proc-macros")) [client-reply] (id:17) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 17 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "begin" :title "Loading proc-macros" :cancellable :json-false))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Loading proc-macros" :value (:kind "end"))) [server-request] (id:18) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 18 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:18) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 18 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:19) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 19 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Roots Scanned")) [client-reply] (id:19) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 19 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "begin" :title "Roots Scanned" :cancellable :json-false :message= "0/3" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/alloc" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/core" :percentage 0))) [server-request] (id:20) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 20 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:20) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 20 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "2/12 (core + 4 more)= " :percentage 16))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "5/12 (core + 2 more)= " :percentage 41))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "6/12 (core + 1 more)= " :percentage 50))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/backtrace" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_abort" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/panic_unwind" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/portable-simd" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/proc_macro" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/profiler_builtins" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rtstartup" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-alloc" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-core" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/rustc-std-workspace-std" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/std" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/stdarch" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "7/12 (core)" :percen= tage 58))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/sysroot" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/test" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "0/3: /home/brennan/.= rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/lib= rary/unwind" :percentage 0))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3" :percentage 33)= )) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: " :percentage 3= 3))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "1/3: src" :percentag= e 33))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "report" :cancellable :json-false :message "2/3" :percentage 66)= )) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Roots Scanned" :value (:kind "end" :message "3/3"))) [server-request] (id:21) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 21 :method "window/workDoneProgress/create" :params (:token "rust-analyzer/flycheck/0")) [client-reply] (id:21) Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :id 21 :result nil) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "begin" :title "cargo check" :cancellable t))) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params (:uri "file:///home/brennan/test_rust/src/main.rs" :diagnostics [(:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :severity 1 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "cannot find type `HashSet` in this scope\nnot= found in this scope" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 0 :character 0) :end (:line 0 :character 0))) :message "consider importing this struct: `use std::collections::Hash= Set;\n\n`")] :data (:rendered "error[E0412]: cannot find type `HashSet` in this scope\n --= > src/main.rs:5:11\n |\n5 | impl<T> S<HashSet<T>> {\n | ^^^^^^^= not found in this scope\n |\nhelp: consider importing this struct\n |\n1= + use std::collections::HashSet;\n |\n\n")) (:range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :severity 4 :code "E0412" :codeDescription (:href "https://doc.rust-lang.org/error-index.html#E0412") :source "rustc" :message "consider importing this struct: `use std::col= lections::HashSet;\n\n`" :relatedInformation [(:location (:uri "file:///home/brennan/test_rust/src/main.rs" :range (:start (:line 4 :character 10) :end (:line 4 :character 17))) :message "original diagnostic")])] :version 0)) [server-notification] Mon Sep 16 12:50:04 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rust-analyzer/flycheck/0" :value (:kind "end"))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 66))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "8/12 (alloc)" :perce= ntage 66))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 75))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "9/12 (std)" :percent= age 75))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 83))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "10/12 (proc_macro)" = :percentage 83))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 91))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :message "11/12 (test_rust)" := percentage 91))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [server-request] (id:22) Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :id 22 :method "window/workDoneProgress/create" :params (:token "rustAnalyzer/Indexing")) [client-reply] (id:22) Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :id 22 :result nil) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0= ))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 91))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "report" :cancellable :json-false :percentage 100))) [server-notification] Mon Sep 16 12:50:05 2024: (:jsonrpc "2.0" :method "$/progress" :params (:token "rustAnalyzer/Indexing" :value (:kind "end"))) [client-request] (id:6) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 6 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 9))) [client-request] (id:7) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 7 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 9))) [client-request] (id:8) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 8 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 9))) [server-reply] (id:6) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 6 :result nil) [server-reply] (id:8) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 8 :result [(:range (:start (:line 4 :character 8) :end (:line 4 :character 9))) (:range (:start (:line 0 :character 7) :end (:line 0 :character 8)))]) [server-reply] (id:7) Mon Sep 16 12:50:07 2024: (:jsonrpc "2.0" :id 7 :result (:contents (:kind "plaintext" :value "test_rust\n\nstruct S<T> {\n x: T,\n}") :range (:start (:line 4 :character 8) :end (:line 4 :character 9)))) [client-request] (id:9) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 9 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:10) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 10 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:11) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 11 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [server-reply] (id:9) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 9 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:10) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 10 :result nil) [server-reply] (id:11) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 11 :result nil) [client-request] (id:12) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 12 :method "textDocument/completion" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17) :context (:triggerKind 1))) [server-reply] (id:12) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 12 :result (:isIncomplete t :items [(:label "HashSet (use std::collections::HashSet)" :kind 22 :detail "Ha= shSet<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` whe= re the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires= that the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freq= uently be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you imple= ment these yourself,\nit is important that the following property holds:\n\= n```text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, = if two keys are equal, their hashes must be equal.\nViolating this property= is a logic error.\n\nIt is also a logic error for a key to be modified in = such a way that the key's\nhash, as determined by the [`Hash`] trait, or it= s equality, as determined by\nthe [`Eq`] trait, changes while it is in the = map. This is normally only\npossible through [`Cell`], [`RefCell`], global = state, I/O, or unsafe code.\n\nThe behavior resulting from either logic err= or is not specified, but will\nbe encapsulated to the `HashSet` that observ= ed the logic error and not\nresult in undefined behavior. This could includ= e panics, incorrect results,\naborts, memory leaks, and non-termination.\n\= n# Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference l= ets us omit an explicit type signature (which\n// would be `HashSet<String>= ` in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books= .\nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To K= ill a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string()= );\nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a speci= fic one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We = have {} books, but The Winds of Winter ain't one.\",\n books.le= n());\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate= over everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\= n\nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`]= and [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`E= q`] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, = Eq, PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usiz= e,\n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { nam= e: \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Ein= ar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_s= tring(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string()= , power: 8 });\n\n// Use derived implementation to print the vikings.\nfor = x in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a kno= wn list of items can be initialized from an array:\n\n```rust\nuse std::col= lections::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf= \", \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-varian= t-of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`Re= fCell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :t= extEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [] :data (:position (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17)) :imports [(:full_import_path "std::collections::HashSet" :imported_name "Hash= Set")] :version 0)) (:label "self::" :kind 14 :deprecated :json-false :preselect t :sortTe= xt "ffffffef" :filterText "self::" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "self::") :additionalTextEdits []) (:label "crate::" :kind 14 :deprecated :json-false :preselect t :sortT= ext "ffffffef" :filterText "crate::" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "crate::") :additionalTextEdits []) (:label "Self" :kind 12 :detail "S<{unknown}>" :deprecated :json-false= :preselect t :sortText "ffffffef" :filterText "Self" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Self") :additionalTextEdits []) (:label "T" :kind 25 :deprecated :json-false :preselect t :sortText "f= fffffef" :filterText "T" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "T") :additionalTextEdits []) (:label "S" :kind 22 :detail "S<{unknown}>" :deprecated :json-false :p= reselect t :sortText "ffffffef" :filterText "S" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "S") :additionalTextEdits []) (:label "panic!" :kind 3 :detail "macro_rules! panic" :deprecated :jso= n-false :preselect t :sortText "ffffffef" :filterText "panic!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "panic!") :additionalTextEdits []) (:label "println!" :kind 3 :detail "macro_rules! println" :documentati= on (:kind "markdown" :value "Prints to the standard output, with a newli= ne.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+0= 00A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macr= o uses the same syntax as [`format!`], but writes to the standard output in= stead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will= lock the standard output on each call. If you call\n`println!` within a ho= t loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lo= ck stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdou= t, Write};\n\nlet mut lock =3D stdout().lock();\nwriteln!(lock, \"hello wor= ld\").unwrap();\n```\n\nUse `println!` only for the primary output of your = program. Use\n[`eprintln!`] instead to print error and progress messages.\n= \nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\n= for details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`ep= rintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics= if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can = cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: cr= ate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newl= ine\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\= ");\nlet local_variable =3D \"some\";\nprintln!(\"format {local_variable} a= rguments\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "println!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "println!") :additionalTextEdits []) (:label "debug_assert_eq!" :kind 3 :detail "macro_rules! debug_assert_= eq" :documentation (:kind "markdown" :value "Asserts that two expressions are equal to e= ach other.\n\nOn panic, this macro will print the values of the expressions= with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert= _eq!` statements are only enabled in non\noptimized builds by default. An o= ptimized build will not execute\n`debug_assert_eq!` statements unless `-C d= ebug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` = useful for checks that are too\nexpensive to be present in a release build = but may be helpful during\ndevelopment. The result of expanding `debug_asse= rt_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet= b =3D 1 + 2;\ndebug_assert_eq!(a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert_eq!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert_eq!") :additionalTextEdits []) (:label "include_str!" :kind 3 :detail "macro_rules! include_str" :doc= umentation (:kind "markdown" :value "Includes a UTF-8 encoded file as a string.\= n\nThe file is located relative to the current file (similarly to how\nmodu= les are found). The provided path is interpreted in a platform-specific\nwa= y at compile time. So, for instance, an invocation with a Windows path\ncon= taining backslashes `\\` would not compile correctly on Unix.\n\nThis macro= will yield an expression of type `&'static str` which is the\ncontents of = the file.\n\n# Examples\n\nAssume there are two files in the same directory= with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadi=C3=B3s= \n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str =3D includ= e_str!(\"spanish.in\");\n assert_eq!(my_str, \"adi=C3=B3s\\n\");\n pr= int!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resultin= g binary will print \"adi=C3=B3s\".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include_str!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include_str!") :additionalTextEdits []) (:label "concat!" :kind 3 :detail "macro_rules! concat" :documentation (:kind "markdown" :value "Concatenates literals into a static string = slice.\n\nThis macro takes any number of comma-separated literals, yielding= an\nexpression of type `&'static str` which represents all of the literals= \nconcatenated left-to-right.\n\nInteger and floating point literals are [s= tringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\= n```rust\nlet s =3D concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test= 10btrue\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "concat!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "concat!") :additionalTextEdits []) (:label "format!" :kind 3 :detail "macro_rules! format" :documentation (:kind "markdown" :value "Creates a `String` using interpolation of r= untime expressions.\n\nThe first argument `format!` receives is a format st= ring. This must be a string\nliteral. The power of the formatting string is= in the `{}`s contained.\nAdditional parameters passed to `format!` replace= the `{}`s within the\nformatting string in the order given unless named or= positional parameters\nare used.\n\nSee [the formatting syntax documentati= on in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for = `format!` is concatenation and interpolation of strings.\nThe same conventi= on is used with [`print!`] and [`write!`] macros,\ndepending on the intende= d destination of the string; all these macros internally use [`format_args!= `].\n\nTo convert a single value to a string, use the [`to_string`] method.= This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literal= s into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/m= acro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_ar= gs\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display= \n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting= trait implementation returns an error.\nThis indicates an incorrect implem= entation\nsince `fmt::Write for String` never returns an error itself.\n\n#= Examples\n\n```rust\nformat!(\"test\"); // =3D= > \"test\"\nformat!(\"hello {}\", \"world!\"); // =3D> \"hell= o world!\"\nformat!(\"x =3D {}, y =3D {val}\", 10, val =3D 30); // =3D> \"= x =3D 10, y =3D 30\"\nlet (x, y) =3D (1, 2);\nformat!(\"{x} + {y} =3D 3\");= // =3D> \"1 + 2 =3D 3\"\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "format!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "format!") :additionalTextEdits []) (:label "stringify!" :kind 3 :detail "macro_rules! stringify" :documen= tation (:kind "markdown" :value "Stringifies its arguments.\n\nThis macro wi= ll yield an expression of type `&'static str` which is the\nstringification= of all the tokens passed to the macro. No restrictions\nare placed on the = syntax of the macro invocation itself.\n\nNote that the expanded results of= the input tokens may change in the\nfuture. You should be careful if you r= ely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one =3D stringify= !(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "stringify!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "stringify!") :additionalTextEdits []) (:label "assert_ne!" :kind 3 :detail "macro_rules! assert_ne" :documen= tation (:kind "markdown" :value "Asserts that two expressions are not equal = to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the= values of the expressions with their\ndebug representations.\n\nLike [`ass= ert!`], this macro has a second form, where a custom\npanic message can be = provided.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet b =3D 2;\nassert_ne!(= a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\"= );\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert_ne!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert_ne!") :additionalTextEdits []) (:label "dbg!" :kind 3 :detail "macro_rules! dbg" :documentation (:kind "markdown" :value "Prints and returns the value of a given exp= ression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = =3D 2;\nlet b =3D dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2:9] a= * 2 =3D 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` = implementation of the type of\nthe given expression to print the value to [= stderr] along with the\nsource location of the macro invocation as well as = the source code\nof the expression.\n\nInvoking the macro on an expression = moves and takes ownership of it\nbefore returning the evaluated expression = unchanged. If the type\nof the expression does not implement `Copy` and you= don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)= `\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same i= n release builds.\nThis is useful when debugging issues that only occur in = release\nbuilds or when debugging in release mode is significantly faster.\= n\nNote that the macro is intended as a debugging tool and therefore you\ns= hould avoid having uses of it in version control for long periods\n(other t= han in tests and similar).\nDebug output from production code is better don= e with other facilities\nsuch as the [`debug!`] macro from the [`log`] crat= e.\n\n# Stability\n\nThe exact output printed by this macro should not be r= elied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writ= ing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n= ```rust\nfn foo(n: usize) {\n if let Some(_) =3D dbg!(n.checked_sub(4)) = {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n`= ``text,ignore\n[src/main.rs:2:22] n.checked_sub(4) =3D None\n```\n\nNaive f= actorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if = dbg!(n <=3D 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial= (n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\= n\n```text,ignore\n[src/main.rs:2:8] n <=3D 1 =3D false\n[src/main.rs:2:8] = n <=3D 1 =3D false\n[src/main.rs:2:8] n <=3D 1 =3D false\n[src/main.rs:2:8]= n <=3D 1 =3D true\n[src/main.rs:3:9] 1 =3D 1\n[src/main.rs:7:9] n * factor= ial(n - 1) =3D 2\n[src/main.rs:7:9] n * factorial(n - 1) =3D 6\n[src/main.r= s:7:9] n * factorial(n - 1) =3D 24\n[src/main.rs:9:1] factorial(4) =3D 24\n= ```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper arou= nd `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoC= opy(usize);\n\nlet a =3D NoCopy(42);\nlet _ =3D dbg!(a); // <-- `a` is move= d here.\nlet _ =3D dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou c= an also use `dbg!()` without a value to just print the\nfile and line whene= ver it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it= will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(d= bg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trail= ing comma will still not be treated\nas a tuple, following the convention o= f ignoring trailing commas in macro\ninvocations. You can use a 1-tuple dir= ectly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing = comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]= : https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[= `debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://cra= tes.io/crates/log") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "dbg!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "dbg!") :additionalTextEdits []) (:label "vec!" :kind 3 :detail "macro_rules! vec" :documentation (:kind "markdown" :value "Creates a [`Vec`] containing the arguments.= \n\n`vec!` allows `Vec`s to be defined with the same syntax as array expres= sions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing= a given list of elements:\n\n```rust\nlet v =3D vec![1, 2, 3];\nassert_eq!= (v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [= `Vec`] from a given element and size:\n\n```rust\nlet v =3D vec![1; 3];\nas= sert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syn= tax supports all elements\nwhich implement [`Clone`] and the number of elem= ents doesn't have to be\na constant.\n\nThis will use `clone` to duplicate = an expression, so one should be careful\nusing this with types having a non= standard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will c= reate a vector of five references\nto the same boxed integer value, not fiv= e references pointing to independently\nboxed integers.\n\nAlso, note that = `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still = evaluate `expr`, however, and immediately drop the resulting value, so\nbe = mindful of side effects.\n\n[`Vec`]: crate::vec::Vec") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "vec!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "vec!") :additionalTextEdits []) (:label "include!" :kind 3 :detail "macro_rules! include" :documentati= on (:kind "markdown" :value "Parses a file as an expression or an item a= ccording to the context.\n\n**Warning**: For multi-file Rust projects, the = `include!` macro is probably not what you\nare looking for. Usually, multi-= file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items= /modules.html). Multi-file projects and\nmodules are explained in the Rust-= by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split= .html) and the module system is\nexplained in the Rust Book\n[here](https:/= /doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-priva= cy.html).\n\nThe included file is placed in the surrounding code\n[unhygien= ically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene)= . If\nthe included file is parsed as an expression and variables or functio= ns share names across\nboth files, it could result in variables or function= s being different from what the\nincluded file expected.\n\nThe included fi= le is located relative to the current file (similarly to how modules are\nf= ound). The provided path is interpreted in a platform-specific way at compi= le time. So,\nfor instance, an invocation with a Windows path containing ba= ckslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `incl= ude!` macro is primarily used for two purposes. It is used to include\ndocu= mentation that is written in a separate file and it is used to include [bui= ld artifacts\nusually as a result from the `build.rs`\nscript](https://doc.= rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-scrip= t).\n\nWhen using the `include` macro to include stretches of documentation= , remember that the\nincluded file still needs to be a valid Rust syntax. I= t is also possible to\nuse the [`include_str`] macro as `#![doc =3D include= _str!(\"...\")]` (at the module level) or\n`#[doc =3D include_str!(\"...\")= ]` (at the item level) to include documentation from a plain\ntext or markd= own file.\n\n# Examples\n\nAssume there are two files in the same directory= with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['=F0=9F=99= =88', '=F0=9F=99=8A', '=F0=9F=99=89']\n .iter()\n .cycle()\n .take= (6)\n .collect::<String>()\n```\n\nFile 'main.rs':\n\n```rust\nfn main()= {\n let my_string =3D include!(\"monkeys.in\");\n assert_eq!(\"=F0= =9F=99=88=F0=9F=99=8A=F0=9F=99=89=F0=9F=99=88=F0=9F=99=8A=F0=9F=99=89\", my= _string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' an= d running the resulting binary will print\n\"=F0=9F=99=88=F0=9F=99=8A=F0=9F= =99=89=F0=9F=99=88=F0=9F=99=8A=F0=9F=99=89\".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include!") :additionalTextEdits []) (:label "print!" :kind 3 :detail "macro_rules! print" :documentation (:kind "markdown" :value "Prints to the standard output.\n\nEquivalen= t to the [`println!`] macro except that a newline is not printed at\nthe en= d of the message.\n\nNote that stdout is frequently line-buffered by defaul= t so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure = the output is emitted\nimmediately.\n\nThe `print!` macro will lock the sta= ndard output on each call. If you call\n`print!` within a hot loop, this be= havior may be the bottleneck of the loop.\nTo avoid this, lock stdout with = [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nl= et mut lock =3D stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n= ```\n\nUse `print!` only for the primary output of your program. Use\n[`epr= int!`] instead to print error and progress messages.\n\nSee [the formatting= documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the ma= cro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: cra= te::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Pan= ics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blockin= g stdout can cause an error, which will lead\nthis macro to panic.\n\n# Exa= mples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!= (\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!= (\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint= !(\"this string has a newline, why not choose println! instead?\\n\");\n\ni= o::stdout().flush().unwrap();\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "print!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "print!") :additionalTextEdits []) (:label "write!" :kind 3 :detail "macro_rules! write" :documentation (:kind "markdown" :value "Writes formatted data into a buffer.\n\nThi= s macro accepts a 'writer', a format string, and a list of arguments. Argum= ents will be\nformatted according to the specified format string and the re= sult will be passed to the writer.\nThe writer may be any value with a `wri= te_fmt` method; generally this comes from an\nimplementation of either the = [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the = `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result= `].\n\nSee [`std::fmt`] for more information on the format string syntax.\n= \n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[= `io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Resu= lt\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nus= e std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w =3D = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted= {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");= \n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std= ::io::Write` and call `write!` on objects\nimplementing either, as objects = do not typically implement both. However, the module must\navoid conflict b= etween the trait names, such as by importing them as `_` or otherwise renam= ing\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\= n\nfn main() -> Result<(), Box<dyn std::error::Error>> {\n let mut s =3D= String::new();\n let mut v =3D Vec::new();\n\n write!(&mut s, \"{} {= }\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = =3D {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s =3D \= \\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names = themselves, such as to implement one or both on your types,\nimport the con= taining module and then name them with a prefix:\n\n```rust\nuse std::fmt::= {self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\= nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> co= re::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This = macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are = responsible for the implementation details of the components.\n\n```rust\nu= se core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn= write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemen= ted!();\n }\n}\n\nlet mut m =3D Example{};\nwrite!(&mut m, \"Hello World= \").expect(\"Not written\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "write!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "write!") :additionalTextEdits []) (:label "line!" :kind 3 :detail "macro_rules! line" :documentation (:kind "markdown" :value "Expands to the line number on which it was = invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging = information for\ndevelopers about the location within the source.\n\nThe ex= panded expression has type `u32` and is 1-based, so the first line\nin each= file evaluates to 1, the second to 2, etc. This is consistent\nwith error = messages by common compilers or popular editors.\nThe returned line is *not= necessarily* the line of the `line!` invocation itself,\nbut rather the fi= rst macro invocation leading up to the invocation\nof the `line!` macro.\n\= n# Examples\n\n```rust\nlet current_line =3D line!();\nprintln!(\"defined o= n line: {current_line}\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "line!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "line!") :additionalTextEdits []) (:label "debug_assert!" :kind 3 :detail "macro_rules! debug_assert" :d= ocumentation (:kind "markdown" :value "Asserts that a boolean expression is `true`= at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expre= ssion cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this = macro also has a second version, where a custom panic\nmessage can be provi= ded.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only e= nabled in non\noptimized builds by default. An optimized build will not exe= cute\n`debug_assert!` statements unless `-C debug-assertions` is passed to = the\ncompiler. This makes `debug_assert!` useful for checks that are too\ne= xpensive to be present in a release build but may be helpful during\ndevelo= pment. The result of expanding `debug_assert!` is always type checked.\n\nA= n unchecked assertion allows a program in an inconsistent state to keep\nru= nning, which might have unexpected consequences but does not introduce\nuns= afety as long as this only happens in safe code. The performance cost\nof a= ssertions, however, is not measurable in general. Replacing [`assert!`]\nwi= th `debug_assert!` is thus only encouraged after thorough profiling, and\nm= ore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic = message for these assertions is the stringified value of the\n// expression= given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { = true } // a very simple function\ndebug_assert!(some_expensive_computation(= ));\n\n// assert with a custom message\nlet x =3D true;\ndebug_assert!(x, \= "x wasn't true!\");\n\nlet a =3D 3; let b =3D 27;\ndebug_assert!(a + b =3D= =3D 30, \"a =3D {}, b =3D {}\", a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert!") :additionalTextEdits []) (:label "include_bytes!" :kind 3 :detail "macro_rules! include_bytes" = :documentation (:kind "markdown" :value "Includes a file as a reference to a byte ar= ray.\n\nThe file is located relative to the current file (similarly to how\= nmodules are found). The provided path is interpreted in a platform-specifi= c\nway at compile time. So, for instance, an invocation with a Windows path= \ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis = macro will yield an expression of type `&'static [u8; N]` which is\nthe con= tents of the file.\n\n# Examples\n\nAssume there are two files in the same = directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\na= di=C3=B3s\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = =3D include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3= s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCo= mpiling 'main.rs' and running the resulting binary will print \"adi=C3=B3s\= ".") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "include_bytes!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "include_bytes!") :additionalTextEdits []) (:label "env!" :kind 3 :detail "macro_rules! env" :documentation (:kind "markdown" :value "Inspects an environment variable at compile= time.\n\nThis macro will expand to the value of the named environment vari= able at\ncompile time, yielding an expression of type `&'static str`. Use\n= [`std::env::var`] instead if you want to read the value at runtime.\n\n[`st= d::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not= defined, then a compilation error\nwill be emitted. To not emit a compile = error, use the [`option_env!`]\nmacro instead. A compilation error will als= o be emitted if the\nenvironment variable is not a vaild Unicode string.\n\= n# Examples\n\n```rust\nlet path: &'static str =3D env!(\"PATH\");\nprintln= !(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou= can customize the error message by passing a string as the second\nparamet= er:\n\n```rust\nlet doc: &'static str =3D env!(\"documentation\", \"what's = that?!\");\n```\n\nIf the `documentation` environment variable is not defin= ed, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "env!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "env!") :additionalTextEdits []) (:label "try!" :kind 3 :detail "macro_rules! r#try" :documentation (:kind "markdown" :value "Unwraps a result or propagates its error.\n= \nThe [`?` operator][propagating-errors] was added to replace `try!`\nand s= hould be used instead. Furthermore, `try` is a reserved word\nin Rust 2018,= so if you must use it, you will need to use the\n[raw-identifier syntax][r= is]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-= 02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-th= e--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compa= tibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In ca= se of the `Ok` variant, the\nexpression has the value of the wrapped value.= \n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then= \nperforms conversion using `From`. This provides automatic conversion\nbet= ween specialized errors and more general ones. The resulting\nerror is then= immediately returned.\n\nBecause of the early return, `try!` can only be u= sed in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std= ::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n = FileWriteError\n}\n\nimpl From<io::Error> for MyError {\n fn from(e: io:= :Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The p= referred method of quick returning Errors\nfn write_to_file_question() -> R= esult<(), MyError> {\n let mut file =3D File::create(\"my_best_friends.t= xt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n = Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to= _file_using_try() -> Result<(), MyError> {\n let mut file =3D r#try!(Fil= e::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is = a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:= \nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file= =3D r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_a= ll(b\"This is a list of my best friends.\") {\n Ok(v) =3D> v,\n = Err(e) =3D> return Err(From::from(e)),\n }\n Ok(())\n}\n```") :deprecated t :preselect t :sortText "ffffffef" :filterText "try!" :t= extEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "r#try!") :additionalTextEdits [] :tags [1]) (:label "file!" :kind 3 :detail "macro_rules! file" :documentation (:kind "markdown" :value "Expands to the file name in which it was in= voked.\n\nWith [`line!`] and [`column!`], these macros provide debugging in= formation for\ndevelopers about the location within the source.\n\nThe expa= nded expression has type `&'static str`, and the returned file\nis not the = invocation of the `file!` macro itself, but rather the\nfirst macro invocat= ion leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n``= `rust\nlet this_file =3D file!();\nprintln!(\"defined in file: {this_file}\= ");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "file!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "file!") :additionalTextEdits []) (:label "thread_local!" :kind 3 :detail "macro_rules! thread_local" :d= ocumentation (:kind "markdown" :value "Declare a new thread local storage key of t= ype [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of= static declarations and makes them thread local.\nPublicity and attributes= for each static are allowed. Example:\n\n```rust\nuse std::cell::{Cell, Re= fCell};\n\nthread_local! {\n pub static FOO: Cell<u32> =3D Cell::new(1);= \n\n static BAR: RefCell<Vec<f32>> =3D RefCell::new(vec![1.0, 2.0]);\n}\= n\nassert_eq!(FOO.get(), 1);\nBAR.with_borrow(|v| assert_eq!(v[1], 2.0));\n= ```\n\nNote that only shared references (`&T`) to the inner data may be obt= ained, so a\ntype such as [`Cell`] or [`RefCell`] is typically used to allo= w mutating access.\n\nThis macro supports a special `const {}` syntax that = can be used\nwhen the initialization expression can be evaluated as a const= ant.\nThis can enable a more efficient thread local implementation that\nca= n avoid lazy initialization. For types that do not\n[need to be dropped][cr= ate::mem::needs_drop], this can enable an\neven more efficient implementati= on that does not need to\ntrack any additional state.\n\n```rust\nuse std::= cell::RefCell;\n\nthread_local! {\n pub static FOO: RefCell<Vec<u32>> = =3D const { RefCell::new(Vec::new()) };\n}\n\nFOO.with_borrow(|v| assert_eq= !(v.len(), 0));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalK= ey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::Lo= calKey") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "thread_local!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "thread_local!") :additionalTextEdits []) (:label "assert!" :kind 3 :detail "macro_rules! assert" :documentation (:kind "markdown" :value "Asserts that a boolean expression is `true`= at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expre= ssion cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions ar= e always checked in both debug and release builds, and cannot\nbe disabled.= See [`debug_assert!`] for assertions that are not enabled in\nrelease buil= ds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time inv= ariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `a= ssert!` include testing and enforcing run-time\ninvariants in safe code (wh= ose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macr= o has a second form, where a custom panic message can\nbe provided with or = without arguments for formatting. See [`std::fmt`]\nfor syntax for this for= m. Expressions used as format arguments will only\nbe evaluated if the asse= rtion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rus= t\n// the panic message for these assertions is the stringified value of th= e\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { = true } // a very simple function\n\nassert!(some_computation());\n\n// asse= rt with a custom message\nlet x =3D true;\nassert!(x, \"x wasn't true!\");\= n\nlet a =3D 3; let b =3D 27;\nassert!(a + b =3D=3D 30, \"a =3D {}, b =3D {= }\", a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert!") :additionalTextEdits []) (:label "column!" :kind 3 :detail "macro_rules! column" :documentation (:kind "markdown" :value "Expands to the column number at which it wa= s invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging = information for\ndevelopers about the location within the source.\n\nThe ex= panded expression has type `u32` and is 1-based, so the first column\nin ea= ch line evaluates to 1, the second to 2, etc. This is consistent\nwith erro= r messages by common compilers or popular editors.\nThe returned column is = *not necessarily* the line of the `column!` invocation itself,\nbut rather = the first macro invocation leading up to the invocation\nof the `column!` m= acro.\n\n# Examples\n\n```rust\nlet current_col =3D column!();\nprintln!(\"= defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code = points, not bytes or graphemes. As a result, the first two\ninvocations ret= urn the same value, but the third does not.\n\n```rust\nlet a =3D (\"foobar= \", column!()).1;\nlet b =3D (\"=E4=BA=BA=E4=B9=8B=E5=88=9D=E6=80=A7=E6=9C= =AC=E5=96=84\", column!()).1;\nlet c =3D (\"f=CC=85o=CC=85o=CC=85b=CC=85a= =CC=85r=CC=85\", column!()).1; // Uses combining overline (U+0305)\n\nasser= t_eq!(a, b);\nassert_ne!(b, c);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "column!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "column!") :additionalTextEdits []) (:label "unreachable!" :kind 3 :detail "macro_rules! unreachable" :doc= umentation (:kind "markdown" :value "Indicates unreachable code.\n\nThis is usef= ul any time that the compiler can't determine that some code is unreachable= . For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynami= cally terminate.\n* Iterators that dynamically terminate.\n\nIf the determi= nation that the code is unreachable proves incorrect, the\nprogram immediat= ely terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro i= s the [`unreachable_unchecked`] function, which\nwill cause undefined behav= ior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unre= achable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unrea= chable!` is just a shorthand for `panic!` with a\nfixed, specific message.\= n\nLike `panic!`, this macro has a second form for displaying custom values= .\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option<i32>) {\n ma= tch x {\n Some(n) if n >=3D 0 =3D> println!(\"Some(Non-negative)\"),= \n Some(n) if n < 0 =3D> println!(\"Some(Negative)\"),\n Som= e(_) =3D> unreachable!(), // compile error if commented out\n = None =3D> println!(\"None\")\n }\n}\n```\n\nIterators:\= n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest imple= mentations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 ov= erflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\= "The loop should always return\");\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "unreachable!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "unreachable!") :additionalTextEdits []) (:label "eprintln!" :kind 3 :detail "macro_rules! eprintln" :documenta= tion (:kind "markdown" :value "Prints to the standard error, with a newlin= e.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`i= o::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.= \n\nUse `eprintln!` only for error and progress messages. Use `println!`\ni= nstead for the primary output of your program.\n\nSee [the formatting docum= entation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro ar= gument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate:= :io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing = to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error= , which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!= (\"Error: Could not complete task\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "eprintln!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "eprintln!") :additionalTextEdits []) (:label "unimplemented!" :kind 3 :detail "macro_rules! unimplemented" = :documentation (:kind "markdown" :value "Indicates unimplemented code by panicking w= ith a message of \"not implemented\".\n\nThis allows your code to type-chec= k, which is useful if you are prototyping or\nimplementing a trait that req= uires multiple methods which you don't plan to use all of.\n\nThe differenc= e between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an = intent of implementing the functionality later and the message is \"not yet= \nimplemented\", `unimplemented!` makes no such claims. Its message is \"no= t implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis= will always [`panic!`] because `unimplemented!` is just a shorthand for `p= anic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a = second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Ex= amples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&s= elf) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result<u64, ()>;\n}\n= ```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it on= ly makes sense\nto implement the `bar()` function. `baz()` and `qux()` will= still need to be defined\nin our implementation of `Foo`, but we can use `= unimplemented!` in their definitions\nto allow our code to compile.\n\nWe s= till want to have our program stop running if the unimplemented methods are= \nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn = bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n //= It makes no sense to `baz` a `MyStruct`, so we have no logic here\n = // at all.\n // This will display \"thread 'main' panicked at 'not = implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> R= esult<u64, ()> {\n // We have some logic here,\n // We can ad= d a message to unimplemented! to display our omission.\n // This wil= l display:\n // \"thread 'main' panicked at 'not implemented: MyStru= ct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n= }\n}\n\nfn main() {\n let s =3D MyStruct;\n s.bar();\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "unimplemented!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "unimplemented!") :additionalTextEdits []) (:label "cfg!" :kind 3 :detail "macro_rules! cfg" :documentation (:kind "markdown" :value "Evaluates boolean combinations of configura= tion flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this = macro is provided to allow\nboolean expression evaluation of configuration = flags. This frequently\nleads to less duplicated code.\n\nThe syntax given = to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unli= ke `#[cfg]`, does not remove any code and only evaluates to true or false. = For\nexample, all blocks in an if/else expression need to be valid when `cf= g!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\= n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# = Examples\n\n```rust\nlet my_directory =3D if cfg!(windows) {\n \"windows= -specific-directory\"\n} else {\n \"unix-directory\"\n};\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "cfg!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "cfg!") :additionalTextEdits []) (:label "todo!" :kind 3 :detail "macro_rules! todo" :documentation (:kind "markdown" :value "Indicates unfinished code.\n\nThis can be u= seful if you are prototyping and just\nwant a placeholder to let your code = pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!= ` is that while `todo!` conveys\nan intent of implementing the functionalit= y later and the message is \"not yet\nimplemented\", `unimplemented!` makes= no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs wil= l mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!`= is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike = `panic!`, this macro has a second form for displaying custom values.\n\n# E= xamples\n\nHere's an example of some in-progress code. We have a trait `Foo= `:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n = fn qux(&self) -> Result<u64, ()>;\n}\n```\n\nWe want to implement `Foo` = on one of our types, but we also want to work on\njust `bar()` first. In or= der for our code to compile, we need to implement\n`baz()` and `qux()`, so = we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {= \n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n = // Let's not worry about implementing baz() for now\n todo!()= ;\n }\n\n fn qux(&self) -> Result<u64, ()> {\n // We can add a= message to todo! to display our omission.\n // This will display:\n= // \"thread 'main' panicked at 'not yet implemented: MyStruct is no= t yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n= }\n\nfn main() {\n let s =3D MyStruct;\n s.bar();\n\n // We aren't= even using baz() or qux(), so this is fine.\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "todo!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "todo!") :additionalTextEdits []) (:label "module_path!" :kind 3 :detail "macro_rules! module_path" :doc= umentation (:kind "markdown" :value "Expands to a string that represents the cur= rent module path.\n\nThe current module path can be thought of as the hiera= rchy of modules\nleading back up to the crate root. The first component of = the path\nreturned is the name of the crate currently being compiled.\n\n# = Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module= _path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "module_path!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "module_path!") :additionalTextEdits []) (:label "option_env!" :kind 3 :detail "macro_rules! option_env" :docum= entation (:kind "markdown" :value "Optionally inspects an environment variable= at compile time.\n\nIf the named environment variable is present at compil= e time, this will\nexpand into an expression of type `Option<&'static str>`= whose value is\n`Some` of the value of the environment variable. If the en= vironment\nvariable is not present, then this will expand to `None`. See\n[= `Option<T>`][Option] for more information on this type. Use\n[`std::env::v= ar`] instead if you want to read the value at runtime.\n\n[`std::env::var`]= : ../std/env/fn.var.html\n\nA compile time error is never emitted when usin= g this macro regardless\nof whether the environment variable is present or = not.\nTo emit a compile error if the environment variable is not present,\n= use the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&= 'static str> =3D option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key mi= ght be: {key:?}\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "option_env!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "option_env!") :additionalTextEdits []) (:label "writeln!" :kind 3 :detail "macro_rules! writeln" :documentati= on (:kind "markdown" :value "Write formatted data into a buffer, with a = newline appended.\n\nOn all platforms, the newline is the LINE FEED charact= er (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).= \n\nFor more information, see [`write!`]. For information on the format str= ing syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# = Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<(= )> {\n let mut w =3D Vec::new();\n writeln!(&mut w)?;\n writeln!(&= mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;= \n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes())= ;\n Ok(())\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "writeln!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "writeln!") :additionalTextEdits []) (:label "assert_eq!" :kind 3 :detail "macro_rules! assert_eq" :documen= tation (:kind "markdown" :value "Asserts that two expressions are equal to e= ach other (using [`PartialEq`]).\n\nOn panic, this macro will print the val= ues of the expressions with their\ndebug representations.\n\nLike [`assert!= `], this macro has a second form, where a custom\npanic message can be prov= ided.\n\n# Examples\n\n```rust\nlet a =3D 3;\nlet b =3D 1 + 2;\nassert_eq!(= a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b= );\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "assert_eq!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "assert_eq!") :additionalTextEdits []) (:label "compile_error!" :kind 3 :detail "macro_rules! compile_error" = :documentation (:kind "markdown" :value "Causes compilation to fail with the given e= rror message when encountered.\n\nThis macro should be used when a crate us= es a conditional compilation strategy to provide\nbetter error messages for= erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emi= ts an error during *compilation* rather than at *runtime*.\n\n# Examples\n\= nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better c= ompiler error if a macro is passed invalid values. Without the final branch= ,\nthe compiler would still emit an error, but the error's message would no= t mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_ba= r {\n (foo) =3D> {};\n (bar) =3D> {};\n ($x:ident) =3D> {\n = compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ng= ive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \= "This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if = one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feat= ure =3D \"foo\", feature =3D \"bar\")))]\ncompile_error!(\"Either feature \= \\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "compile_error!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "compile_error!") :additionalTextEdits []) (:label "matches!" :kind 3 :detail "macro_rules! matches" :documentati= on (:kind "markdown" :value "Returns whether the given expression matche= s the provided pattern.\n\nThe pattern syntax is exactly the same as found = in a match arm. The optional if guard can be\nused to add additional checks= that must be true for the matched value, otherwise this macro will\nreturn= `false`.\n\nWhen testing that a value matches a pattern, it's generally pr= eferable to use\n[`assert_matches!`] as it will print the debug representat= ion of the value if the assertion\nfails.\n\n# Examples\n\n```rust\nlet foo= =3D 'f';\nassert!(matches!(foo, 'A'..=3D'Z' | 'a'..=3D'z'));\n\nlet bar = =3D Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "matches!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "matches!") :additionalTextEdits []) (:label "format_args!" :kind 3 :detail "macro_rules! format_args" :doc= umentation (:kind "markdown" :value "Constructs parameters for the other string-= formatting macros.\n\nThis macro functions by taking a formatting string li= teral containing\n`{}` for each additional argument passed. `format_args!` = prepares the\nadditional parameters to ensure the output can be interpreted= as a string\nand canonicalizes the arguments into a single type. Any value= that implements\nthe [`Display`] trait can be passed to `format_args!`, as= can any\n[`Debug`] implementation be passed to a `{:?}` within the formatt= ing string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This= value can be\npassed to the macros within [`std::fmt`] for performing usef= ul redirection.\nAll other formatting macros ([`format!`], [`write!`], [`pr= intln!`], etc) are\nproxied through this one. `format_args!`, unlike its de= rived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments= `] value that `format_args!` returns\nin `Debug` and `Display` contexts as = seen below. The example also shows\nthat `Debug` and `Display` format to th= e same thing: the interpolated\nformat string in `format_args!`.\n\n```rust= \nlet debug =3D format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nle= t display =3D format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert= _eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the f= ormatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details = of the macro argument syntax, and further information.\n\n[`Display`]: crat= e::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::f= mt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/mac= ro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n``= `rust\nuse std::fmt;\n\nlet s =3D fmt::format(format_args!(\"hello {}\", \"= world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```\n\n# Life= time limitation\n\nExcept when no formatting arguments are used,\nthe produ= ced `fmt::Arguments` value borrows temporary values,\nwhich means it can on= ly be used within the same expression\nand cannot be stored for later use.\= nThis is a known limitation, see [#92698](https://github.com/rust-lang/rust= /issues/92698).") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "format_args!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "format_args!") :additionalTextEdits []) (:label "is_x86_feature_detected!" :kind 3 :detail "macro_rules! is_x8= 6_feature_detected" :documentation (:kind "markdown" :value "A macro to test at *runtime* whether a CPU = feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in= the standard library and will detect at runtime\nwhether the specified CPU= feature is detected. This does **not** resolve at\ncompile time unless the= specified feature is already enabled for the entire\ncrate. Runtime detect= ion currently relies mostly on the `cpuid` instruction.\n\nThis macro only = takes one argument which is a string literal of the feature\nbeing tested f= or. The feature names supported are the lowercase versions of\nthe ones def= ined by Intel in [their documentation][docs].\n\n## Supported arguments\n\n= This macro supports the same names that `#[target_feature]` supports. Unlik= e\n`#[target_feature]`, however, this macro does not support names separate= d\nwith a comma. Instead testing for multiple features must be done through= \nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"a= es\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\= "mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.= 1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`= \n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* = `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `= \"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`= \n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"= `\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"avx512fp16\"`\n* `\= "f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\= "`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt= \"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"= rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/= sites/landingpage/IntrinsicsGuide") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "is_x86_feature_detected!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "is_x86_feature_detected!") :additionalTextEdits []) (:label "eprint!" :kind 3 :detail "macro_rules! eprint" :documentation (:kind "markdown" :value "Prints to the standard error.\n\nEquivalent= to the [`print!`] macro, except that output goes to\n[`io::stderr`] instea= d of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` on= ly for error and progress messages. Use `print!`\ninstead for the primary o= utput of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]= : crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../= std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\= n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stde= rr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\= n\n```rust\neprint!(\"Error: Could not complete task\");\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "eprint!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "eprint!") :additionalTextEdits []) (:label "debug_assert_ne!" :kind 3 :detail "macro_rules! debug_assert_= ne" :documentation (:kind "markdown" :value "Asserts that two expressions are not equal = to each other.\n\nOn panic, this macro will print the values of the express= ions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_as= sert_ne!` statements are only enabled in non\noptimized builds by default. = An optimized build will not execute\n`debug_assert_ne!` statements unless `= -C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_n= e!` useful for checks that are too\nexpensive to be present in a release bu= ild but may be helpful during\ndevelopment. The result of expanding `debug_= assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a =3D 3;\= nlet b =3D 2;\ndebug_assert_ne!(a, b);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "debug_assert_ne!" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "debug_assert_ne!") :additionalTextEdits []) (:label "std" :kind 9 :documentation (:kind "markdown" :value "# The Rust Standard Library\n\nThe Rust Sta= ndard Library is the foundation of portable Rust software, a\nset of minima= l and battle-tested shared abstractions for the [broader Rust\necosystem][c= rates.io]. It offers core types, like [`Vec<T>`] and\n[`Option<T>`], librar= y-defined [operations on language\nprimitives](#primitives), [standard macr= os](#macros), [I/O] and\n[multithreading], among [many other things][other]= .\n\n`std` is available to all Rust crates by default. Therefore, the\nstan= dard library can be accessed in [`use`] statements through the path\n`std`,= as in [`use std::env`].\n\n# How to read this documentation\n\nIf you alre= ady know the name of what you are looking for, the fastest way to\nfind it = is to use the <a href=3D\"#\" onclick=3D\"window.searchState.focus();\">sea= rch\nbar</a> at the top of the page.\n\nOtherwise, you may want to jump to = one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primiti= ve types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\= n\nIf this is your first time, the documentation for the standard library i= s\nwritten to be casually perused. Clicking on interesting things should\ng= enerally lead you to interesting places. Still, there are important bits\ny= ou don't want to miss, so read on for a tour of the standard library and\ni= ts documentation!\n\nOnce you are familiar with the contents of the standar= d library you may\nbegin to find the verbosity of the prose distracting. At= this stage in your\ndevelopment you may want to press the `[-]` button nea= r the top of the\npage to collapse it into a more skimmable view.\n\nWhile = you are looking at that `[-]` button also notice the `source`\nlink. Rust's= API documentation comes with the source code and you are\nencouraged to re= ad it. The standard library source is generally high\nquality and a peek be= hind the curtains is often enlightening.\n\n# What is in the standard libra= ry documentation?\n\nFirst of all, The Rust Standard Library is divided int= o a number of focused\nmodules, [all listed further down this page](#module= s). These modules are\nthe bedrock upon which all of Rust is forged, and th= ey have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' docume= ntation typically\nincludes an overview of the module along with examples, = and are a smart\nplace to start familiarizing yourself with the library.\n\= nSecond, implicit methods on [primitive types] are documented here. This ca= n\nbe a source of confusion for two reasons:\n\n1. While primitives are imp= lemented by the compiler, the standard library\n implements methods direc= tly on the primitive types (and it is the only\n library that does so), w= hich are [documented in the section on\n primitives](#primitives).\n2. Th= e standard library exports many modules *with the same name as\n primitiv= e types*. These define additional items related to the primitive\n type, = but not the all-important methods.\n\nSo for example there is a [page for t= he primitive type\n`i32`](primitive::i32) that lists all the methods that c= an be called on\n32-bit integers (very useful), and there is a [page for th= e module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`= ] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] an= d [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String= `] and [`Vec<T>`] are actually\ncalls to methods on [`str`] and [`[T]`][pri= m@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, t= he standard library defines [The Rust Prelude], a small collection\nof item= s - mostly traits - that are imported into every module of every\ncrate. Th= e traits in the prelude are pervasive, making the prelude\ndocumentation a = good entry point to learning about the library.\n\nAnd finally, the standar= d library exports a number of standard macros, and\n[lists them on this pag= e](#macros) (technically, not all of the standard\nmacros are defined by th= e standard library - some are defined by the\ncompiler - but they are docum= ented here the same). Like the prelude, the\nstandard macros are imported b= y default into all crates.\n\n# Contributing changes to the documentation\n= \nCheck out the Rust contribution guidelines [here](\nhttps://rustc-dev-gui= de.rust-lang.org/contributing.html#writing-documentation).\nThe source for = this documentation can be found on\n[GitHub](https://github.com/rust-lang/r= ust).\nTo contribute changes, make sure you read the guidelines first, then= submit\npull-requests for your suggested changes.\n\nContributions are app= reciated! If you see a part of the docs that can be\nimproved, submit a PR,= or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of Th= e Rust Standard Library\n\nThe rest of this crate documentation is dedicate= d to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Con= tainers and collections\n\nThe [`option`] and [`result`] modules define opt= ional and error-handling\ntypes, [`Option<T>`] and [`Result<T, E>`]. The [`= iter`] module defines\nRust's iterator trait, [`Iterator`], which works wit= h the [`for`] loop to\naccess collections.\n\nThe standard library exposes = three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec<T>= `] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][= prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]= `][prim@slice] - A dynamically sized *slice* into any other kind of contigu= ous\n storage, whether heap-allocated or not.\n\nSlices can only be handle= d through some kind of *pointer*, and as such come\nin many flavors such as= :\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]= >`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a pri= mitive type, and the standard library\ndefines many methods for it. Rust [`= str`]s are typically accessed as\nimmutable references: `&str`. Use the own= ed [`String`] for building and\nmutating strings.\n\nFor converting to stri= ngs use the [`format!`] macro, and for converting from\nstrings use the [`F= romStr`] trait.\n\nData may be shared by placing it in a reference-counted = box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCel= l`], may be mutated\nas well as shared. Likewise, in a concurrent setting i= t is common to pair an\natomically-reference-counted box, [`Arc`], with a [= `Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines map= s, sets, linked lists and other\ntypical collection types, including the co= mmon [`HashMap<K, V>`].\n\n## Platform abstractions and I/O\n\nBesides basi= c data types, the standard library is largely concerned with\nabstracting o= ver differences in common platforms, most notably Windows and\nUnix derivat= ives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defi= ned in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module c= ontains Rust's threading abstractions. [`sync`]\ncontains further primitive= shared memory types, including [`atomic`] and\n[`mpsc`], which contains th= e channel types for message passing.\n\n# Use before and after `main()`\n\n= Many parts of the standard library are expected to work before and after `m= ain()`;\nbut this is not guaranteed or ensured by tests. It is recommended = that you write your own tests\nand run them on each platform you wish to su= pport.\nThis means that use of `std` before/after main, especially of featu= res that interact with the\nOS or global state, is exempted from stability = and portability guarantees and instead only\nprovided on a best-effort basi= s. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` an= d `alloc` are most likely to work in such environments with\nthe caveat tha= t any hookable behavior such as panics, oom handling or allocators will als= o\ndepend on the compatibility of the hooks.\n\nSome features may also beha= ve differently outside main, e.g. stdio could become unbuffered,\nsome pani= cs might turn into aborts, backtraces might not get symbolicated or similar= .\n\nNon-exhaustive list of known limitations:\n\n- after-main use of threa= d-locals, which also affects additional features:\n - [`thread::current()`= ]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file de= scriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[= `MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crat= e::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::Udp= Socket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`F= romStr`]: str::FromStr\n[`HashMap<K, V>`]: collections::HashMap\n[`Mutex`]:= sync::Mutex\n[`Option<T>`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: c= ell::RefCell\n[`Result<T, E>`]: result::Result\n[`Vec<T>`]: vec::Vec\n[`ato= mic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-thr= ough-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std:= :cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[= `use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\= n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.h= tml#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\= n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-docume= ntation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]= : https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "std" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "std") :additionalTextEdits []) (:label "core" :kind 9 :documentation (:kind "markdown" :value "# The Rust Core Library\n\nThe Rust Core Li= brary is the dependency-free[^free] foundation of [The\nRust Standard Libra= ry](../std/index.html). It is the portable glue\nbetween the language and i= ts libraries, defining the intrinsic and\nprimitive building blocks of all = Rust code. It links to no\nupstream libraries, no system libraries, and no = libc.\n\n[^free]: Strictly speaking, there are some symbols which are neede= d but\n they aren't always necessary.\n\nThe core library is *minim= al*: it isn't even aware of heap allocation,\nnor does it provide concurren= cy or I/O. These things require\nplatform integration, and this library is = platform-agnostic.\n\n# How to use the core library\n\nPlease note that all= of these details are currently not considered stable.\n\nThis library is b= uilt on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`,= `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n w= hich are generated by Rust codegen backends. Additionally, this library can= make explicit\n calls to `strlen`. Their signatures are the same as found= in C, but there are extra\n assumptions about their semantics: For `memcp= y`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0= , the function is assumed to not be UB, even if the pointers are NULL or\n = dangling. (Note that making extra assumptions about these functions is com= mon among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](= https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)= \n These functions are often provided by the system libc, but can also be = provided by the\n [compiler-builtins crate](https://crates.io/crates/compi= ler_builtins).\n Note that the library does not guarantee that it will alw= ays make these assumptions, so Rust\n user code directly calling the C fun= ctions should follow the C specification! The advice for\n Rust user code = is to call the functions provided by this library instead (such as\n `ptr:= :copy`).\n\n* Panic handler - This function takes one argument, a `&panic::= PanicInfo`. It is up to consumers of this core\n library to define this pa= nic function; it is only required to never\n return. You should mark your = implementation using `#[panic_handler]`.\n\n* `rust_eh_personality` - is us= ed by the failure mechanisms of the\n compiler. This is often mapped to G= CC's personality function, but crates\n which do not trigger a panic can = be assured that this function is never\n called. The `lang` attribute is = called `eh_personality`.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "core" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "core") :additionalTextEdits []) (:label "u32" :kind 22 :detail "u32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u32") :additionalTextEdits []) (:label "bool" :kind 22 :detail "bool" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "bool" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "bool") :additionalTextEdits []) (:label "u8" :kind 22 :detail "u8" :deprecated :json-false :preselect = t :sortText "ffffffef" :filterText "u8" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u8") :additionalTextEdits []) (:label "isize" :kind 22 :detail "isize" :deprecated :json-false :pres= elect t :sortText "ffffffef" :filterText "isize" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "isize") :additionalTextEdits []) (:label "u16" :kind 22 :detail "u16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u16") :additionalTextEdits []) (:label "u64" :kind 22 :detail "u64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "u64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u64") :additionalTextEdits []) (:label "u128" :kind 22 :detail "u128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "u128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "u128") :additionalTextEdits []) (:label "f32" :kind 22 :detail "f32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f32") :additionalTextEdits []) (:label "i128" :kind 22 :detail "i128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "i128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i128") :additionalTextEdits []) (:label "i16" :kind 22 :detail "i16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i16") :additionalTextEdits []) (:label "str" :kind 22 :detail "str" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "str" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "str") :additionalTextEdits []) (:label "i64" :kind 22 :detail "i64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i64") :additionalTextEdits []) (:label "char" :kind 22 :detail "char" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "char" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "char") :additionalTextEdits []) (:label "f128" :kind 22 :detail "f128" :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "f128" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f128") :additionalTextEdits []) (:label "f64" :kind 22 :detail "f64" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f64" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f64") :additionalTextEdits []) (:label "f16" :kind 22 :detail "f16" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "f16" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "f16") :additionalTextEdits []) (:label "i32" :kind 22 :detail "i32" :deprecated :json-false :preselec= t t :sortText "ffffffef" :filterText "i32" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i32") :additionalTextEdits []) (:label "i8" :kind 22 :detail "i8" :deprecated :json-false :preselect = t :sortText "ffffffef" :filterText "i8" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "i8") :additionalTextEdits []) (:label "usize" :kind 22 :detail "usize" :deprecated :json-false :pres= elect t :sortText "ffffffef" :filterText "usize" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "usize") :additionalTextEdits []) (:label "AsMut" :kind 8 :documentation (:kind "markdown" :value "Used to do a cheap mutable-to-mutable refer= ence conversion.\n\nThis trait is similar to [`AsRef`] but used for convert= ing between mutable\nreferences. If you need to do a costly conversion it i= s better to\nimplement [`From`] with type `&mut T` or write a custom functi= on.\n\n**Note: This trait must not fail**. If the conversion can fail, use = a\ndedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].\n= \n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type = is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` h= as type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reason= s, the above currently does not hold generally for all\n[mutably dereferenc= eable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(fo= o).as_mut()`. Instead, many smart pointers provide an `as_mut` implementati= on which\nsimply returns a reference to the [pointed-to value] (but do not = perform a cheap\nreference-to-reference conversion for that value). However= , [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable der= eferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferen= ceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::T= arget\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n= ```rust\nlet mut x =3D Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = =3D x.as_mut();\n// Better just write:\nlet y: &mut i32 =3D &mut x;\n```\n\= nTypes which implement [`DerefMut`] should consider to add an implementatio= n of `AsMut<T>` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rus= t\nimpl<T> AsMut<T> for SomeType\nwhere\n <SomeType as Deref>::Target: A= sMut<T>,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut()= .as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be refl= exive, i.e. there would be an `impl<T: ?Sized> AsMut<T> for T`\nwith [`as_m= ut`] simply returning its argument unchanged.\nSuch a blanket implementatio= n is currently *not* provided due to technical restrictions of\nRust's type= system (it would be overlapping with another existing blanket implementati= on for\n`&mut T where T: AsMut<U>` which allows `AsMut` to auto-dereference= , see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\n= A trivial implementation of `AsMut<T> for T` must be added explicitly for a= particular type `T`\nwhere needed or desired. Note, however, that not all = types from `std` contain such an\nimplementation, and those cannot be added= by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as tr= ait bound for a generic function, we can accept all mutable references that= \ncan be converted to type `&mut T`. Unlike [dereference], which has a sing= le [target type],\nthere can be multiple implementations of `AsMut` for a t= ype. In particular, `Vec<T>` implements\nboth `AsMut<Vec<T>>` and `AsMut<[T= ]>`.\n\nIn the following, the example functions `caesar` and `null_terminat= e` provide a generic\ninterface which work with any type that can be conver= ted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or b= yte vector (`Vec<u8>`), respectively.\n\n[dereference]: core::ops::DerefMut= \n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n = info: String,\n content: Vec<u8>,\n}\n\nimpl<T: ?Sized> AsMut<T> for D= ocument\nwhere\n Vec<u8>: AsMut<T>,\n{\n fn as_mut(&mut self) -> &mut= T {\n self.content.as_mut()\n }\n}\n\nfn caesar<T: AsMut<[u8]>>(= data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = =3D byte.wrapping_add(key);\n }\n}\n\nfn null_terminate<T: AsMut<Vec<u8>= >>(data: &mut T) {\n // Using a non-generic inner function, which contai= ns most of the\n // functionality, helps to minimize monomorphization ov= erhead.\n fn doit(data: &mut Vec<u8>) {\n let len =3D data.len();= \n if len =3D=3D 0 || data[len-1] !=3D 0 {\n data.push(0)= ;\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mu= t v: Vec<u8> =3D vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, = [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\= n let mut doc =3D Document {\n info: String::from(\"Example\"),\n= content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n as= sert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n ass= ert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs d= on't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec<u= 8>`, for example, is the better choice (callers need to pass the correct ty= pe then).") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "AsMut" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "AsMut") :additionalTextEdits []) (:label "AsRef" :kind 8 :documentation (:kind "markdown" :value "Used to do a cheap reference-to-reference c= onversion.\n\nThis trait is similar to [`AsMut`] which is used for converti= ng between mutable references.\nIf you need to do a costly conversion it is= better to implement [`From`] with type\n`&T` or write a custom function.\n= \n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], b= ut [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`= ] has a blanket impl for any `T`, and can be used to accept either\n a ref= erence or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`B= orrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed valu= e are\n equivalent to those of the owned value. For this reason, if you wa= nt to\n borrow only a single field of a struct you can implement `AsRef`, = but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversio= n can fail, use a\ndedicated method which returns an [`Option<T>`] or a [`R= esult<T, E>`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if= the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()= ` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote = that due to historic reasons, the above currently does not hold generally f= or all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the sa= me as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `a= s_ref` implementation which\nsimply returns a reference to the [pointed-to = value] (but do not perform a cheap\nreference-to-reference conversion for t= hat value). However, [`AsRef::as_ref`] should not be\nused for the sole pur= pose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[derefe= renceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::T= arget\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nle= t x =3D Box::new(5i32);\n// Avoid this:\n// let y: &i32 =3D x.as_ref();\n//= Better just write:\nlet y: &i32 =3D &x;\n```\n\nTypes which implement [`De= ref`] should consider implementing `AsRef<T>` as follows:\n\n[`Deref`]: cor= e::ops::Deref\n\n```rust\nimpl<T> AsRef<T> for SomeType\nwhere\n T: ?Siz= ed,\n <SomeType as Deref>::Target: AsRef<T>,\n{\n fn as_ref(&self) ->= &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIde= ally, `AsRef` would be reflexive, i.e. there would be an `impl<T: ?Sized> A= sRef<T> for T`\nwith [`as_ref`] simply returning its argument unchanged.\nS= uch a blanket implementation is currently *not* provided due to technical r= estrictions of\nRust's type system (it would be overlapping with another ex= isting blanket implementation for\n`&T where T: AsRef<U>` which allows `AsR= ef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_r= ef`]: AsRef::as_ref\n\nA trivial implementation of `AsRef<T> for T` must be= added explicitly for a particular type `T`\nwhere needed or desired. Note,= however, that not all types from `std` contain such an\nimplementation, an= d those cannot be added by external code due to orphan rules.\n\n# Examples= \n\nBy using trait bounds we can accept arguments of different types as lon= g as they can be\nconverted to the specified type `T`.\n\nFor example: By c= reating a generic function that takes an `AsRef<str>` we express that we\nw= ant to accept all references that can be converted to [`&str`] as an argume= nt.\nSince both [`String`] and [`&str`] implement `AsRef<str>` we can accep= t both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::bo= rrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]:= ../../std/string/struct.String.html\n\n```rust\nfn is_hello<T: AsRef<str>>= (s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s =3D \"hello\";\= nis_hello(s);\n\nlet s =3D \"hello\".to_string();\nis_hello(s);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "AsRef" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "AsRef") :additionalTextEdits []) (:label "Box" :kind 22 :detail "Box<{unknown}, {unknown}>" :documentat= ion (:kind "markdown" :value "A pointer type that uniquely owns a heap al= location of type `T`.\n\nSee the [module-level documentation](../../std/box= ed/index.html) for more.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Box" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Box") :additionalTextEdits []) (:label "Clone" :kind 8 :documentation (:kind "markdown" :value "A common trait for the ability to explicitl= y duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implici= t and an inexpensive bit-wise copy, while\n`Clone` is always explicit and m= ay or may not be expensive. In order to enforce\nthese characteristics, Rus= t does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clo= ne` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`],= you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## De= rivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone= `. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field= .\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implement= s `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n= ```rust\n// `derive` implements Clone for Reading<T> when T is Clone.\n#[de= rive(Clone)]\nstruct Reading<T> {\n frequency: T,\n}\n```\n\n## How can = I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial imple= mentation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, th= en `let x =3D y.clone();` is equivalent to `let x =3D *y;`.\nManual impleme= ntations should be careful to uphold this invariant; however, unsafe code\n= must not rely on it to ensure memory safety.\n\nAn example is a generic str= uct holding a function pointer. In this case, the\nimplementation of `Clone= ` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Genera= te<T>(fn() -> T);\n\nimpl<T> Copy for Generate<T> {}\n\nimpl<T> Clone for G= enerate<T> {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n= \nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate<T>(fn= () -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T= : Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl= <T: Copy> Copy for Generate<T> { }\n\n// Automatically derived\nimpl<T: Clo= ne> Clone for Generate<T> {\n fn clone(&self) -> Generate<T> {\n = Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessar= y because clearly the function itself should be\ncopy- and cloneable even i= f its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Genera= te<T>(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() ->= NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).cl= one(); // error: trait bounds were not satisfied\n// Note: With the manual = implementations the above line will compile.\n```\n\n## Additional implemen= tors\n\nIn addition to the [implementors listed below][impls],\nthe followi= ng types also implement `Clone`:\n\n* Function item types (i.e., the distin= ct types defined for each function)\n* Function pointer types (e.g., `fn() = -> i32`)\n* Closure types, if they capture no value from the environment\n = or if all such captured values implement `Clone` themselves.\n Note that = variables captured by shared reference always implement `Clone`\n (even if= the referent doesn't),\n while variables captured by mutable reference ne= ver implement `Clone`.\n\n[impls]: #implementors") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Clone" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Clone") :additionalTextEdits []) (:label "Copy" :kind 8 :documentation (:kind "markdown" :value "Types whose values can be duplicated simply= by copying bits.\n\nBy default, variable bindings have 'move semantics.' I= n other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x =3D Foo;= \n\nlet y =3D x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// = println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a typ= e implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can= derive a `Copy` implementation. `Clone` is also required, as it's\n// a su= pertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = =3D Foo;\n\nlet y =3D x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\");= // A-OK!\n```\n\nIt's important to note that in these two examples, the on= ly difference is whether you\nare allowed to access `x` after the assignmen= t. Under the hood, both a copy and a move\ncan result in bits being copied = in memory, although this is sometimes optimized away.\n\n## How can I imple= ment `Copy`?\n\nThere are two ways to implement `Copy` on your type. The si= mplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStr= uct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust= \nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct= {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nTher= e is a small difference between the two: the `derive` strategy will also pl= ace a `Copy`\nbound on type parameters, which isn't always desired.\n\n## W= hat's the difference between `Copy` and `Clone`?\n\nCopies happen implicitl= y, for example as part of an assignment `y =3D x`. The behavior of\n`Copy` = is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an = explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide = any type-specific behavior necessary to duplicate values safely. For exampl= e,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointe= d-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values= would merely copy the\npointer, leading to a double free down the line. Fo= r this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a s= upertrait of `Copy`, so everything which is `Copy` must also implement\n[`C= lone`]. If a type is `Copy` then its [`Clone`] implementation only needs to= return `*self`\n(see the example above).\n\n## When can my type be `Copy`?= \n\nA type can implement `Copy` if all of its components implement `Copy`. = For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]= \nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`,= and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy con= trast, consider\n\n```rust\nstruct PointList {\n points: Vec<Point>,\n}\= n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec<T>`] = is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get = an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type;= field `points` does not implement `Copy`\n```\n\nShared references (`&T`) = are also `Copy`, so a type can be `Copy`, even when it holds\nshared refere= nces of types `T` that are *not* `Copy`. Consider the following struct,\nwh= ich can implement `Copy`, because it only holds a *shared reference* to our= non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)= ]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n``= `\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safel= y. For example, copying `&mut T` would create an aliased\nmutable reference= . Copying [`String`] would duplicate responsibility for managing the\n[`Str= ing`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, = any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some= resource besides its own [`size_of::<T>`] bytes.\n\nIf you try to implemen= t `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe = error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should*= my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Co= py`, it should. Keep in mind, though,\nthat implementing `Copy` is part of = the public API of your type. If the type might become\nnon-`Copy` in the fu= ture, it could be prudent to omit the `Copy` implementation now, to\navoid = a breaking API change.\n\n## Additional implementors\n\nIn addition to the = [implementors listed below][impls],\nthe following types also implement `Co= py`:\n\n* Function item types (i.e., the distinct types defined for each fu= nction)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, i= f they capture no value from the environment\n or if all such captured val= ues implement `Copy` themselves.\n Note that variables captured by shared = reference always implement `Copy`\n (even if the referent doesn't),\n whi= le variables captured by mutable reference never implement `Copy`.\n\n[`Vec= <T>`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.S= tring.html\n[`size_of::<T>`]: crate::mem::size_of\n[impls]: #implementors") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Copy" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Copy") :additionalTextEdits []) (:label "Default" :kind 8 :documentation (:kind "markdown" :value "A trait for giving a type a useful default = value.\n\nSometimes, you want to fall back to some kind of default value, a= nd\ndon't particularly care what it is. This comes up often with `struct`s\= nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i= 32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You ca= n use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n = foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = =3D Default::default();\n}\n```\n\nNow, you get all of the default values. = Rust implements `Default` for various primitives types.\n\nIf you want to o= verride a particular option, but still retain the other defaults:\n\n```rus= t\nfn main() {\n let options =3D SomeOptions { foo: 42, ..Default::defau= lt() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` = if all of the type's fields implement\n`Default`. When `derive`d, it will u= se the default value for each field's type.\n\n### `enum`s\n\nWhen using `#= [derive(Default)]` on an `enum`, you need to choose which unit variant will= be\ndefault. You do this by placing the `#[default]` attribute on the vari= ant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n = B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-u= nit or non-exhaustive variants.\n\nThe `#[default]` attribute was stabilize= d in Rust 1.62.0.\n\n## How can I implement `Default`?\n\nProvide an implem= entation for the `default()` method that returns the value of\nyour type th= at should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n= }\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\= n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo= : i32,\n bar: f32,\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Default" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Default") :additionalTextEdits []) (:label "DoubleEndedIterator" :kind 8 :documentation (:kind "markdown" :value "An iterator able to yield elements from bot= h ends.\n\nSomething that implements `DoubleEndedIterator` has one extra ca= pability\nover something that implements [`Iterator`]: the ability to also = take\n`Item`s from the back, as well as the front.\n\nIt is important to no= te that both back and forth work on the same range,\nand do not cross: iter= ation is over when they meet in the middle.\n\nIn a similar fashion to the = [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from = a [`next_back()`], calling it\nagain may or may not ever return [`Some`] ag= ain. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\= n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::n= ext\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers =3D vec![1, 2, 3,= 4, 5, 6];\n\nlet mut iter =3D numbers.iter();\n\nassert_eq!(Some(&1), iter= .next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), it= er.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), = iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.ne= xt());\nassert_eq!(None, iter.next_back());\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "DoubleEndedIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "DoubleEndedIterator") :additionalTextEdits []) (:label "Drop" :kind 8 :documentation (:kind "markdown" :value "Custom code within the destructor.\n\nWhen = a value is no longer needed, Rust will run a \"destructor\" on that value.\= nThe most common way that a value is no longer needed is when it goes out o= f\nscope. Destructors may still run in other circumstances, but we're going= to\nfocus on scope for the examples here. To learn about some of those oth= er cases,\nplease see [the reference] section on destructors.\n\n[the refer= ence]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destruc= tor consists of two components:\n- A call to `Drop::drop` for that value, i= f this special `Drop` trait is implemented for its type.\n- The automatical= ly generated \"drop glue\" which recursively calls the destructors\n of = all the fields of this value.\n\nAs Rust automatically calls the destructor= s of all contained fields,\nyou don't have to implement `Drop` in most case= s. But there are some cases where\nit is useful, for example for types whic= h directly manage a resource.\nThat resource may be memory, it may be a fil= e descriptor, it may be a network socket.\nOnce a value of that type is no = longer going to be used, it should \"clean up\" its\nresource by freeing th= e memory or closing the file or socket. This is\nthe job of a destructor, a= nd therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors = in action, let's take a look at the following program:\n\n```rust\nstruct H= asDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n print= ln!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: Has= Drop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mu= t self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn mai= n() {\n let _x =3D HasTwoDrops { one: HasDrop, two: HasDrop };\n prin= tln!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` a= nd then for both `_x.one` and `_x.two`,\nmeaning that running this will pri= nt\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping= HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTw= oDrop`, the destructors of its fields are still called.\nThis would result = in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## Yo= u cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clea= n up a value, it may be dangerous to use this value after\nthe method has b= een called. As `Drop::drop` does not take ownership of its input,\nRust pre= vents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other= words, if you tried to explicitly call `Drop::drop` in the above example, = you'd get a compiler error.\n\nIf you'd like to explicitly call the destruc= tor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n= \n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For stru= cts, it's the same\norder that they're declared: first `one`, then `two`. I= f you'd like to try\nthis yourself, you can modify `HasDrop` above to conta= in some data, like an\ninteger, and then use it in the `println!` inside of= `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for struct= s, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\= nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping= Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut = self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n = let _foo =3D Foo;\n let _bar =3D Bar;\n}\n```\n\nThis will print\n\n```t= ext\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for th= e full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destr= uctors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement b= oth [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implic= itly duplicated by the compiler, making it very\nhard to predict when, and = how often destructors will be executed. As such,\nthese types cannot have d= estructors.\n\n## Drop check\n\nDropping interacts with the borrow checker = in subtle ways: when a type `T` is being implicitly\ndropped as some variab= le of this type goes out of scope, the borrow checker needs to ensure that\= ncalling `T`'s destructor at this moment is safe. In particular, it also ne= eds to be safe to\nrecursively drop all the fields of `T`. For example, it = is crucial that code like the following\nis being rejected:\n\n```rust\nuse= std::cell::Cell;\n\nstruct S<'a>(Cell<Option<&'a S<'a>>>, Box<i32>);\nimpl= Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) =3D sel= f.0.get() {\n // Print the contents of the `Box` in `r`.\n = println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Se= t up two `S` that point to each other.\n let s1 =3D S(Cell::new(None), B= ox::new(42));\n let s2 =3D S(Cell::new(Some(&s1)), Box::new(42));\n s= 1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the= 2nd one\n // to be dropped will access the `Box` in the first one,\n = // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need fo= r [drop check in more detail][drop check].\n\nTo reject such code, the \"dr= op check\" analysis determines which types and lifetimes need to\nstill be = live when `T` gets dropped. The exact details of this analysis are not yet\= nstably guaranteed and **subject to change**. Currently, the analysis works= as follows:\n- If `T` has no drop glue, then trivially nothing is required= to be live. This is the case if\n neither `T` nor any of its (recursive) = fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDr= op`] are considered to never have a destructor, no matter their field type.= \n- If `T` has drop glue, then, for all types `U` that are *owned* by any f= ield of `T`,\n recursively add the types and lifetimes that need to be liv= e when `U` gets dropped. The set of\n owned types is determined by recursi= vely traversing `T`:\n - Recursively descend through `PhantomData`, `Box`,= tuples, and arrays (including arrays of\n length 0).\n - Stop at refer= ence and raw pointer types as well as function pointers and function items;= \n they do not own anything.\n - Stop at non-composite types (type para= meters that remain generic in the current context and\n base types such = as integers and `bool`); these types are owned.\n - When hitting an ADT wi= th `impl Drop`, stop there; this type is owned.\n - When hitting an ADT wi= thout `impl Drop`, recursively descend to its fields. (For an `enum`,\n = consider all fields of all variants.)\n- Furthermore, if `T` implements `Dr= op`, then all generic (lifetime and type) parameters of `T`\n must be live= .\n\nIn the above example, the last clause implies that `'a` must be live w= hen `S<'a>` is dropped,\nand hence the example is rejected. If we remove th= e `impl Drop`, the liveness requirement\ndisappears and the example is acce= pted.\n\nThere exists an unstable way for a type to opt-out of the last cla= use; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more deta= ils on this nightly-only feature, see the\n[discussion in the Nomicon][nomi= con].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate= ::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: = ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standa= rd-library-and-its-unstable-may_dangle") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Drop" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Drop") :additionalTextEdits []) (:label "Eq (alias =3D=3D, !=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for comparisons corresponding to [equ= ivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\= n\nThis means, that in addition to `a =3D=3D b` and `a !=3D b` being strict= inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive= : `a =3D=3D a`;\n- symmetric: `a =3D=3D b` implies `b =3D=3D a` (required b= y `PartialEq` as well); and\n- transitive: `a =3D=3D b` and `b =3D=3D c` im= plies `a =3D=3D c` (required by `PartialEq` as well).\n\nThis property cann= ot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], a= nd has no extra methods.\n\nViolating this property is a logic error. The b= ehavior resulting from a logic error is not\nspecified, but users of the tr= ait must ensure that such logic errors do *not* result in\nundefined behavi= or. This means that `unsafe` code **must not** rely on the correctness of t= hese\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guarant= eed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in add= ition to\nthe symmetric and transitive properties already required by `Part= ialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `d= erive`d, because `Eq` has\nno extra methods, it is only informing the compi= ler that this is an\nequivalence relation rather than a partial equivalence= relation. Note that\nthe `derive` strategy requires all fields are `Eq`, w= hich isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you canno= t use the `derive` strategy, specify that your type implements\n`Eq`, which= has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }= \nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq= for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn = =3D=3D other.isbn\n }\n}\nimpl Eq for Book {}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Eq" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Eq") :additionalTextEdits []) (:label "ExactSizeIterator" :kind 8 :documentation (:kind "markdown" :value "An iterator that knows its exact length.\n\= nMany [`Iterator`]s don't know how many times they will iterate, but some d= o.\nIf an iterator knows how many times it can iterate, providing access to= \nthat information can be useful. For example, if you want to iterate\nback= wards, a good start is to know where the end is.\n\nWhen implementing an `E= xactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, th= e implementation of [`Iterator::size_hint`]\n*must* return the exact size o= f the iterator.\n\nThe [`len`] method has a default implementation, so you = usually shouldn't\nimplement it. However, you may be able to provide a more= performant\nimplementation than the default, so overriding it in this case= makes sense.\n\nNote that this trait is a safe trait and as such does *not= * and *cannot*\nguarantee that the returned length is correct. This means t= hat `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size= _hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen)= trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len= \n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter = makes an iterator *longer*, then it's usually incorrect for\nthat adapter t= o implement `ExactSizeIterator`. The inner exact-sized\niterator might alr= eady be `usize::MAX`-long, and thus the length of the\nlonger adapted itera= tor would no longer be exactly representable in `usize`.\n\nThis is why [`C= hain<A, B>`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` = and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```r= ust\n// a finite range knows exactly how many times it will iterate\nlet fi= ve =3D 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level doc= s], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeI= terator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nim= pl ExactSizeIterator for Counter {\n // We can easily calculate the rema= ining number of iterations.\n fn len(&self) -> usize {\n 5 - self= .count\n }\n}\n\n// And now we can use it!\n\nlet mut counter =3D Counte= r::new();\n\nassert_eq!(5, counter.len());\nlet _ =3D counter.next();\nasse= rt_eq!(4, counter.len());\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ExactSizeIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ExactSizeIterator") :additionalTextEdits []) (:label "Extend" :kind 8 :documentation (:kind "markdown" :value "Extend a collection with the contents of an= iterator.\n\nIterators produce a series of values, and collections can als= o be thought\nof as a series of values. The `Extend` trait bridges this gap= , allowing you\nto extend a collection by including the contents of that it= erator. When\nextending a collection with an already existing key, that ent= ry is updated\nor, in the case of collections that permit multiple entries = with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n= ```rust\n// You can extend a String with some chars:\nlet mut message =3D S= tring::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b= ', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `E= xtend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec<= T>\n#[derive(Debug)]\nstruct MyCollection(Vec<i32>);\n\n// Let's give it so= me methods so we can create one and add things\n// to it.\nimpl MyCollectio= n {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n = }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\= n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32= \nimpl Extend<i32> for MyCollection {\n\n // This is a bit simpler with = the concrete type signature: we can call\n // extend on anything which c= an be turned into an Iterator which gives\n // us i32s. Because we need = i32s to put into MyCollection.\n fn extend<T: IntoIterator<Item=3Di32>>(= &mut self, iter: T) {\n\n // The implementation is very straightforw= ard: loop through the\n // iterator, and add() each element to ourse= lves.\n for elem in iter {\n self.add(elem);\n }\n= }\n}\n\nlet mut c =3D MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.a= dd(7);\n\n// let's extend our collection with three more numbers\nc.extend(= vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\= "MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Extend" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Extend") :additionalTextEdits []) (:label "Fn" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= an immutable receiver.\n\nInstances of `Fn` can be called repeatedly witho= ut mutating state.\n\n*This trait (`Fn`) is not to be confused with [functi= on pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures whi= ch only take immutable\nreferences to captured variables or don't capture a= nything at all, as well\nas (safe) [function pointers] (with some caveats, = see their documentation\nfor more details). Additionally, for any type `F` = that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] a= nd [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as= a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a= bound when you want to accept a parameter of function-like\ntype and need = to call it repeatedly and without mutating state (e.g., when\ncalling it co= ncurrently). If you do not need such strict requirements, use\n[`FnMut`] or= [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Program= ming Language*][book] for\nsome more information on this topic.\n\nAlso of = note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize= `). Those interested in the technical details of\nthis can refer to [the re= levant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-= 01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.ht= ml\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square =3D |x| x *= x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rus= t\nfn call_with_one<F>(func: F) -> usize\n where F: Fn(usize) -> usize {= \n func(1)\n}\n\nlet double =3D |x| x * 2;\nassert_eq!(call_with_one(dou= ble), 2);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Fn" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Fn") :additionalTextEdits []) (:label "FnMut" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and m= ay mutate state.\n\n`FnMut` is implemented automatically by closures which = take mutable\nreferences to captured variables, as well as all types that i= mplement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supe= rtrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`,= `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of = `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expecte= d, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can b= e used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want t= o accept a parameter of function-like\ntype and need to call it repeatedly,= while allowing it to mutate state.\nIf you don't want the parameter to mut= ate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly,= use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming L= anguage*][book] for\nsome more information on this topic.\n\nAlso of note i= s the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Th= ose interested in the technical details of\nthis can refer to [the relevant= section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-clo= sures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n= # Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = =3D 5;\n{\n let mut square_x =3D || x *=3D x;\n square_x();\n}\nasser= t_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice<= F>(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nle= t mut x: usize =3D 1;\n{\n let add_two_to_x =3D || x +=3D 2;\n do_twi= ce(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FnMut" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FnMut") :additionalTextEdits []) (:label "FnOnce" :kind 8 :documentation (:kind "markdown" :value "The version of the call operator that takes= a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not= be callable multiple\ntimes. Because of this, if the only thing known abou= t a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`F= nOnce` is implemented automatically by closures that might consume captured= \nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[= function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince = both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`= ] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as= a bound when you want to accept a parameter of function-like\ntype and onl= y need to call it once. If you need to call the parameter\nrepeatedly, use = [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].= \n\nSee the [chapter on closures in *The Rust Programming Language*][book] = for\nsome more information on this topic.\n\nAlso of note is the special sy= ntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested i= n the technical details of\nthis can refer to [the relevant section in the = *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[fun= ction pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n##= Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish<F>(func: F)\= n where F: FnOnce() -> String\n{\n // `func` consumes its captured va= riables, so it cannot be run more\n // than once.\n println!(\"Consum= ed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to= invoke `func()` again will throw a `use of moved\n // value` error for = `func`.\n}\n\nlet x =3D String::from(\"x\");\nlet consume_and_return_x =3D = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_r= eturn_x` can no longer be invoked at this point\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FnOnce" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FnOnce") :additionalTextEdits []) (:label "From" :kind 8 :documentation (:kind "markdown" :value "Used to do value-to-value conversions while= consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne shoul= d always prefer implementing `From` over [`Into`]\nbecause implementing `Fr= om` automatically provides one with an implementation of [`Into`]\nthanks t= o the blanket implementation in the standard library.\n\nOnly implement [`I= nto`] when targeting a version prior to Rust 1.41 and converting to a type\= noutside the current crate.\n`From` was not able to do these types of conve= rsions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`= ] for more details.\n\nPrefer using [`Into`] over using `From` when specify= ing trait bounds on a generic function.\nThis way, types that directly impl= ement [`Into`] can be used as arguments as well.\n\nThe `From` trait is als= o very useful when performing error handling. When constructing a function\= nthat is capable of failing, the return type will generally be of the form = `Result<T, E>`.\n`From` simplifies error handling by allowing a function to= return a single error type\nthat encapsulates multiple error types. See th= e \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: T= his trait must not fail**. The `From` trait is intended for perfect convers= ions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# = Generic Implementations\n\n- `From<T> for U` implies [`Into`]`<U> for T`\n-= `From` is reflexive, which means that `From<T> for T` is implemented\n\n# = When to implement `From`\n\nWhile there's no technical restrictions on whic= h conversions can be done using\na `From` implementation, the general expec= tation is that the conversions\nshould typically be restricted as follows:\= n\n* The conversion is *infallible*: if the conversion can fail, use [`TryF= rom`]\n instead; don't provide a `From` impl that panics.\n\n* The convers= ion is *lossless*: semantically, it should not lose or discard\n informati= on. For example, `i32: From<u16>` exists, where the original\n value can b= e recovered using `u16: TryFrom<i32>`. And `String: From<&str>`\n exists,= where you can get something equivalent to the original value via\n `Deref= `. But `From` cannot be used to convert from `u32` to `u16`, since\n that= cannot succeed in a lossless way. (There's some wiggle room here for\n i= nformation not considered semantically relevant. For example,\n `Box<[T]>= : From<Vec<T>>` exists even though it might not preserve capacity,\n like = how two vectors can be equal despite differing capacities.)\n\n* The conver= sion is *value-preserving*: the conceptual kind and meaning of\n the resul= ting value is the same, even though the Rust type and technical\n represen= tation might be different. For example `-1_i8 as u8` is *lossless*,\n sin= ce `as` casting back can recover the original value, but that conversion\n = is *not* available via `From` because `-1` and `255` are different concept= ual\n values (despite being identical bit patterns technically). But\n `= f32: From<i16>` *is* available because `1_i16` and `1.0_f32` are conceptual= ly\n the same real number (despite having very different bit patterns tech= nically).\n `String: From<char>` is available because they're both *text*,= but\n `String: From<u32>` is *not* available, since `1` (a number) and `\= "1\"`\n (text) are too different. (Converting values to text is instead c= overed\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversi= on is *obvious*: it's the only reasonable conversion between\n the two typ= es. Otherwise it's better to have it be a named method or\n constructor, = like how [`str::as_bytes`] is a method and how integers have\n methods lik= e [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_byt= es`], none of which are `From` implementations. Whereas\n there's only on= e reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [= `IpAddr`](crate::net::IpAddr), thus `IpAddr: From<Ipv6Addr>` exists.\n\n# E= xamples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion fr= om a `&str` to a String is done as follows:\n\n```rust\nlet string =3D \"he= llo\".to_string();\nlet other_string =3D String::from(\"hello\");\n\nassert= _eq!(string, other_string);\n```\n\nWhile performing error handling it is o= ften useful to implement `From` for your own error type.\nBy converting und= erlying error types to our own custom error type that encapsulates the\nund= erlying error type, we can return a single error type without losing inform= ation on the\nunderlying cause. The '?' operator automatically converts the= underlying error type to our\ncustom error type with `From::from`.\n\n```r= ust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoEr= ror(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From<io::Er= ror> for CliError {\n fn from(error: io::Error) -> Self {\n CliEr= ror::IoError(error)\n }\n}\n\nimpl From<num::ParseIntError> for CliError= {\n fn from(error: num::ParseIntError) -> Self {\n CliError::Par= seError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Resu= lt<i32, CliError> {\n let mut contents =3D fs::read_to_string(&file_name= )?;\n let num: i32 =3D contents.trim().parse()?;\n Ok(num)\n}\n```\n\= n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[bo= ok]: ../../book/ch09-00-error-handling.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "From" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "From") :additionalTextEdits []) (:label "FromIterator" :kind 8 :documentation (:kind "markdown" :value "Conversion from an [`Iterator`].\n\nBy impl= ementing `FromIterator` for a type, you define how it will be\ncreated from= an iterator. This is common for types which describe a\ncollection of some= kind.\n\nIf you want to create a collection from the contents of an iterat= or, the\n[`Iterator::collect()`] method is preferred. However, when you nee= d to\nspecify the container type, [`FromIterator::from_iter()`] can be more= \nreadable than using a turbofish (e.g. `::<Vec<_>>()`). See the\n[`Iterato= r::collect()`] documentation for more examples of its use.\n\nSee also: [`I= ntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives =3D= std::iter::repeat(5).take(5);\n\nlet v =3D Vec::from_iter(five_fives);\n\n= assert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] t= o implicitly use `FromIterator`:\n\n```rust\nlet five_fives =3D std::iter::= repeat(5).take(5);\n\nlet v: Vec<i32> =3D five_fives.collect();\n\nassert_e= q!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as = a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse st= d::collections::VecDeque;\nlet first =3D (0..10).collect::<VecDeque<i32>>()= ;\nlet second =3D VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);= \n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample= collection, that's just a wrapper over Vec<T>\n#[derive(Debug)]\nstruct My= Collection(Vec<i32>);\n\n// Let's give it some methods so we can create one= and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollecti= on {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem= : i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement Fr= omIterator\nimpl FromIterator<i32> for MyCollection {\n fn from_iter<I: = IntoIterator<Item=3Di32>>(iter: I) -> Self {\n let mut c =3D MyColle= ction::new();\n\n for i in iter {\n c.add(i);\n }\= n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = =3D (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = =3D MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);= \n\n// collect works too!\n\nlet iter =3D (0..5).into_iter();\nlet c: MyCol= lection =3D iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "FromIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "FromIterator") :additionalTextEdits []) (:label "Into" :kind 8 :documentation (:kind "markdown" :value "A value-to-value conversion that consumes t= he input value. The\nopposite of [`From`].\n\nOne should avoid implementing= [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatica= lly provides one with an implementation of [`Into`]\nthanks to the blanket = implementation in the standard library.\n\nPrefer using [`Into`] over [`Fro= m`] when specifying trait bounds on a generic function\nto ensure that type= s that only implement [`Into`] can be used as well.\n\n**Note: This trait m= ust not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic I= mplementations\n\n- [`From`]`<T> for U` implies `Into<U> for T`\n- [`Into`]= is reflexive, which means that `Into<T> for T` is implemented\n\n# Impleme= nting [`Into`] for conversions to external types in old versions of Rust\n\= nPrior to Rust 1.41, if the destination type was not part of the current cr= ate\nthen you couldn't implement [`From`] directly.\nFor example, take this= code:\n\n```rust\nstruct Wrapper<T>(Vec<T>);\nimpl<T> From<Wrapper<T>> for= Vec<T> {\n fn from(w: Wrapper<T>) -> Vec<T> {\n w.0\n }\n}\n`= ``\nThis will fail to compile in older versions of the language because Rus= t's orphaning rules\nused to be a little bit more strict. To bypass this, y= ou could implement [`Into`] directly:\n\n```rust\nstruct Wrapper<T>(Vec<T>)= ;\nimpl<T> Into<Vec<T>> for Wrapper<T> {\n fn into(self) -> Vec<T> {\n = self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] = does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]= ). Therefore, you should always try to implement [`From`]\nand then fall ba= ck to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`= ] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that w= e want a generic function to take all arguments that can be\nconverted to a= specified type `T`, we can use a trait bound of [`Into`]`<T>`.\nFor exampl= e: The function `is_hello` takes all arguments that can be converted into a= \n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello<T: Into<Vec<u8>>>(s: T) {\n = let bytes =3D b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\= nlet s =3D \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../s= td/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Into" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Into") :additionalTextEdits []) (:label "IntoIterator" :kind 8 :documentation (:kind "markdown" :value "Conversion into an [`Iterator`].\n\nBy impl= ementing `IntoIterator` for a type, you define how it will be\nconverted to= an iterator. This is common for types which describe a\ncollection of some= kind.\n\nOne benefit of implementing `IntoIterator` is that your type will= [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterat= or).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rus= t\nlet v =3D [1, 2, 3];\nlet mut iter =3D v.into_iter();\n\nassert_eq!(Some= (1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), = iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoItera= tor` for your type:\n\n```rust\n// A sample collection, that's just a wrapp= er over Vec<T>\n#[derive(Debug)]\nstruct MyCollection(Vec<i32>);\n\n// Let'= s give it some methods so we can create one and add things\n// to it.\nimpl= MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::= new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(el= em);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator fo= r MyCollection {\n type Item =3D i32;\n type IntoIter =3D std::vec::I= ntoIter<Self::Item>;\n\n fn into_iter(self) -> Self::IntoIter {\n = self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nle= t mut c =3D MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(= 0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor= (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n``= `\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe = input collection type to change, so long as it is still an\niterator. Addit= ional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn col= lect_as_strings<T>(collection: T) -> Vec<String>\nwhere\n T: IntoIterato= r,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\= n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "IntoIterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "IntoIterator") :additionalTextEdits []) (:label "Iterator" :kind 8 :documentation (:kind "markdown" :value "A trait for dealing with iterators.\n\nThis= is the main iterator trait. For more about the concept of iterators\ngener= ally, please see the [module-level documentation]. In particular, you\nmay = want to know how to [implement `Iterator`][impl].\n\n[module-level document= ation]: crate::iter\n[impl]: crate::iter#implementing-iterator") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Iterator" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Iterator") :additionalTextEdits []) (:label "Option" :kind 13 :detail "Option<{unknown}>" :documentation (:kind "markdown" :value "The `Option` type. See [the module level do= cumentation](self) for more.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Option" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Option") :additionalTextEdits []) (:label "Ord (alias <, >, <=3D, >=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for types that form a [total order](h= ttps://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consi= stent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and= `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) =3D=3D Some(cmp= (a, b))`.\n- `max(a, b) =3D=3D max_by(a, b, cmp)` (ensured by the default i= mplementation).\n- `min(a, b) =3D=3D min_by(a, b, cmp)` (ensured by the def= ault implementation).\n- For `a.clamp(min, max)`, see the [method docs](#me= thod.clamp)\n (ensured by the default implementation).\n\nIt's easy to acc= identally make `cmp` and `partial_cmp` disagree by\nderiving some of the tr= aits and manually implementing others.\n\nViolating these requirements is a= logic error. The behavior resulting from a logic error is not\nspecified, = but users of the trait must ensure that such logic errors do *not* result i= n\nundefined behavior. This means that `unsafe` code **must not** rely on t= he correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and t= he requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:= \n\n- exactly one of `a < b`, `a =3D=3D b` or `a > b` is true; and\n- `<` i= s transitive: `a < b` and `b < c` implies `a < c`. The same must hold for b= oth `=3D=3D` and `>`.\n\nMathematically speaking, the `<` operator defines = a strict [weak order]. In\ncases where `=3D=3D` conforms to mathematical eq= uality, it also defines a\nstrict [total order].\n\n[weak order]: https://e= n.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org= /wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]= `.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https:/= /en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-b= ottom declaration order of the struct's members.\n\nWhen `derive`d on enums= , variants are ordered primarily by their discriminants.\nSecondarily, they= are ordered by their fields.\nBy default, the discriminant is smallest for= variants at the top, and\nlargest for variants at the bottom. Here's an ex= ample:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n = Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manu= ally setting the discriminants can override this default\nbehavior:\n\n```r= ust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top =3D 2,\n = Bottom =3D 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographi= cal comparison\n\nLexicographical comparison is an operation with the follo= wing properties:\n - Two sequences are compared element by element.\n - The= first mismatching element defines which sequence is lexicographically less= or greater than the other.\n - If one sequence is a prefix of another, the= shorter sequence is lexicographically less than the other.\n - If two sequ= ences have equivalent elements and are of the same length, then the sequenc= es are lexicographically equal.\n - An empty sequence is lexicographically = less than any non-empty sequence.\n - Two empty sequences are lexicographic= ally equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the typ= e also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen= you must define an implementation for [`cmp`]. You may find it useful to u= se\n[`cmp`] on your type's fields.\n\nHere's an example where you want to s= ort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse s= td::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n nam= e: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self,= other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }= \n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self= ) -> Option<Ordering> {\n Some(self.cmp(other))\n }\n}\n\nimpl Pa= rtialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n sel= f.height =3D=3D other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Ord" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Ord") :additionalTextEdits []) (:label "PartialEq (alias =3D=3D, !=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for comparisons using the equality op= erator.\n\nImplementing this trait for types provides the `=3D=3D` and `!= =3D` operators for\nthose types.\n\n`x.eq(y)` can also be written `x =3D=3D= y`, and `x.ne(y)` can be written `x !=3D y`.\nWe use the easier-to-read in= fix notation in the remainder of this documentation.\n\nThis trait allows f= or comparisons using the equality operator, for types\nthat do not have a f= ull equivalence relation. For example, in floating point\nnumbers `NaN !=3D= NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`].= Formally speaking, when `Rhs =3D=3D Self`, this trait corresponds\nto a [p= artial equivalence relation].\n\n[partial equivalence relation]: https://en= .wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must en= sure that `eq` and `ne` are consistent with each other:\n\n- `a !=3D b` if = and only if `!(a =3D=3D b)`.\n\nThe default implementation of `ne` provides= this consistency and is almost\nalways sufficient. It should not be overri= dden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also imp= lemented for `Self` and `Rhs`, their methods must also\nbe consistent with = `PartialEq` (see the documentation of those traits for the exact\nrequireme= nts). It's easy to accidentally make them disagree by deriving some of the = traits and\nmanually implementing others.\n\nThe equality relation `=3D=3D`= must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`,= `B`, `C`):\n\n- **Symmetry**: if `A: PartialEq<B>` and `B: PartialEq<A>`, = then **`a =3D=3D b`\n implies `b =3D=3D a`**; and\n\n- **Transitivity**: i= f `A: PartialEq<B>` and `B: PartialEq<C>` and `A:\n PartialEq<C>`, then **= `a =3D=3D b` and `b =3D=3D c` implies `a =3D=3D c`**.\n This must also wor= k for longer chains, such as when `A: PartialEq<B>`, `B: PartialEq<C>`,\n = `C: PartialEq<D>`, and `A: PartialEq<D>` all exist.\n\nNote that the `B: Pa= rtialEq<A>` (symmetric) and `A: PartialEq<C>`\n(transitive) impls are not f= orced to exist, but these requirements apply\nwhenever they do exist.\n\nVi= olating these requirements is a logic error. The behavior resulting from a = logic error is not\nspecified, but users of the trait must ensure that such= logic errors do *not* result in\nundefined behavior. This means that `unsa= fe` code **must not** rely on the correctness of these\nmethods.\n\n## Cros= s-crate considerations\n\nUpholding the requirements stated above can becom= e tricky when one crate implements `PartialEq`\nfor a type of another crate= (i.e., to allow comparing one of its own types with a type from the\nstand= ard library). The recommendation is to never implement this trait for a for= eign type. In\nother words, such a crate should do `impl PartialEq<ForeignT= ype> for LocalType`, but it should\n*not* do `impl PartialEq<LocalType> for= ForeignType`.\n\nThis avoids the problem of transitive chains that criss-c= ross crate boundaries: for all local\ntypes `T`, you may assume that no oth= er crate will add `impl`s that allow comparing `T =3D=3D U`. In\nother word= s, if other crates add `impl`s that allow building longer transitive chains= `U1 =3D=3D ...\n=3D=3D T =3D=3D V1 =3D=3D ...`, then all the types that ap= pear to the right of `T` must be types that the\ncrate defining `T` already= knows about. This rules out transitive chains where downstream crates\ncan= add new `impl`s that \"stitch together\" comparisons of foreign types in w= ays that violate\ntransitivity.\n\nNot having such foreign `impl`s also avo= ids forward compatibility issues where one crate adding\nmore `PartialEq` i= mplementations can cause build failures in downstream crates.\n\n## Derivab= le\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, t= wo\ninstances are equal if all fields are equal, and not equal if any field= s\nare not equal. When `derive`d on enums, two instances are equal if they\= nare the same variant and all fields are equal.\n\n## How can I implement `= PartialEq`?\n\nAn example implementation for a domain in which two books ar= e considered\nthe same book if their ISBN matches, even if the formats diff= er:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook= ,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl P= artialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self= .isbn =3D=3D other.isbn\n }\n}\n\nlet b1 =3D Book { isbn: 3, format: Boo= kFormat::Paperback };\nlet b2 =3D Book { isbn: 3, format: BookFormat::Ebook= };\nlet b3 =3D Book { isbn: 10, format: BookFormat::Paperback };\n\nassert= !(b1 =3D=3D b2);\nassert!(b1 !=3D b3);\n```\n\n## How can I compare two dif= ferent types?\n\nThe type you can compare with is controlled by `PartialEq`= 's type parameter.\nFor example, let's tweak our previous code a bit:\n\n``= `rust\n// The derive implements <BookFormat> =3D=3D <BookFormat> comparison= s\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n= Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\= n\n// Implement <Book> =3D=3D <BookFormat> comparisons\nimpl PartialEq<Book= Format> for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n = self.format =3D=3D *other\n }\n}\n\n// Implement <BookFormat> =3D=3D <B= ook> comparisons\nimpl PartialEq<Book> for BookFormat {\n fn eq(&self, o= ther: &Book) -> bool {\n *self =3D=3D other.format\n }\n}\n\nlet = b1 =3D Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 =3D= =3D BookFormat::Paperback);\nassert!(BookFormat::Ebook !=3D b1);\n```\n\nBy= changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book= `,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison lik= e the one above, which ignores some fields of the struct,\ncan be dangerous= . It can easily lead to an unintended violation of the\nrequirements for a = partial equivalence relation. For example, if we kept\nthe above implementa= tion of `PartialEq<Book>` for `BookFormat` and added an\nimplementation of = `PartialEq<Book>` for `Book` (either via a `#[derive]` or\nvia the manual i= mplementation from the first example) then the result would\nviolate transi= tivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,= \n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n = isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq<BookFormat> for Bo= ok {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format = =3D=3D *other\n }\n}\n\nimpl PartialEq<Book> for BookFormat {\n fn eq= (&self, other: &Book) -> bool {\n *self =3D=3D other.format\n }\n= }\n\nfn main() {\n let b1 =3D Book { isbn: 1, format: BookFormat::Paperb= ack };\n let b2 =3D Book { isbn: 2, format: BookFormat::Paperback };\n\n= assert!(b1 =3D=3D BookFormat::Paperback);\n assert!(BookFormat::Pape= rback =3D=3D b2);\n\n // The following should hold by transitivity but d= oesn't.\n assert!(b1 =3D=3D b2); // <-- PANICS\n}\n```\n\n# Examples\n\n= ```rust\nlet x: u32 =3D 0;\nlet y: u32 =3D 1;\n\nassert_eq!(x =3D=3D y, fal= se);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: P= artialEq::ne") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "PartialEq" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "PartialEq") :additionalTextEdits []) (:label "PartialOrd (alias >, <, <=3D, >=3D)" :kind 8 :documentation (:kind "markdown" :value "Trait for types that form a [partial order]= (https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and= `ge` methods of this trait can be called using\nthe `<`, `<=3D`, `>`, and = `>=3D` operators, respectively.\n\nThe methods of this trait must be consis= tent with each other and with those of [`PartialEq`].\nThe following condit= ions must hold:\n\n1. `a =3D=3D b` if and only if `partial_cmp(a, b) =3D=3D= Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) =3D=3D Some(Le= ss)`\n3. `a > b` if and only if `partial_cmp(a, b) =3D=3D Some(Greater)`\n4= . `a <=3D b` if and only if `a < b || a =3D=3D b`\n5. `a >=3D b` if and onl= y if `a > b || a =3D=3D b`\n6. `a !=3D b` if and only if `!(a =3D=3D b)`.\n= \nConditions 2=E2=80=935 above are ensured by the default implementation.\n= Condition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also impl= emented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp= ` (see the documentation of that trait for the exact requirements). It's\ne= asy to accidentally make them disagree by deriving some of the traits and m= anually\nimplementing others.\n\nThe comparison relations must satisfy the = following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- *= *Transitivity**: if `A: PartialOrd<B>` and `B: PartialOrd<C>` and `A:\n Pa= rtialOrd<C>`, then `a < b` and `b < c` implies `a < c`. The same must hold = for both `=3D=3D` and `>`.\n This must also work for longer chains, such a= s when `A: PartialOrd<B>`, `B: PartialOrd<C>`,\n `C: PartialOrd<D>`, and `= A: PartialOrd<D>` all exist.\n- **Duality**: if `A: PartialOrd<B>` and `B: = PartialOrd<A>`, then `a < b` if and only if `b > a`.\n\nNote that the `B: P= artialOrd<A>` (dual) and `A: PartialOrd<C>`\n(transitive) impls are not for= ced to exist, but these requirements apply\nwhenever they do exist.\n\nViol= ating these requirements is a logic error. The behavior resulting from a lo= gic error is not\nspecified, but users of the trait must ensure that such l= ogic errors do *not* result in\nundefined behavior. This means that `unsafe= ` code **must not** rely on the correctness of these\nmethods.\n\n## Cross-= crate considerations\n\nUpholding the requirements stated above can become = tricky when one crate implements `PartialOrd`\nfor a type of another crate = (i.e., to allow comparing one of its own types with a type from the\nstanda= rd library). The recommendation is to never implement this trait for a fore= ign type. In\nother words, such a crate should do `impl PartialOrd<ForeignT= ype> for LocalType`, but it should\n*not* do `impl PartialOrd<LocalType> fo= r ForeignType`.\n\nThis avoids the problem of transitive chains that criss-= cross crate boundaries: for all local\ntypes `T`, you may assume that no ot= her crate will add `impl`s that allow comparing `T < U`. In\nother words, i= f other crates add `impl`s that allow building longer transitive chains `U1= < ...\n< T < V1 < ...`, then all the types that appear to the right of `T`= must be types that the crate\ndefining `T` already knows about. This rules= out transitive chains where downstream crates can\nadd new `impl`s that \"= stitch together\" comparisons of foreign types in ways that violate\ntransi= tivity.\n\nNot having such foreign `impl`s also avoids forward compatibilit= y issues where one crate adding\nmore `PartialOrd` implementations can caus= e build failures in downstream crates.\n\n## Corollaries\n\nThe following c= orollaries follow from the above requirements:\n\n- irreflexivity of `<` an= d `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c= ` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) =3D=3D parti= al_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial or= ders\n\nThe `<` and `>` operators behave according to a *strict* partial or= der.\nHowever, `<=3D` and `>=3D` do **not** behave according to a *non-stri= ct*\npartial order.\nThat is because mathematically, a non-strict partial o= rder would require\nreflexivity, i.e. `a <=3D a` would need to be true for = every `a`. This isn't\nalways the case for types that implement `PartialOrd= `, for example:\n\n```rust\nlet a =3D f64::sqrt(-1.0);\nassert_eq!(a <=3D a= , false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\= n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en= .wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bott= om declaration order of the struct's members.\n\nWhen `derive`d on enums, v= ariants are primarily ordered by their discriminants.\nSecondarily, they ar= e ordered by their fields.\nBy default, the discriminant is smallest for va= riants at the top, and\nlargest for variants at the bottom. Here's an examp= le:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n B= ottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting= the discriminants can override this default\nbehavior:\n\n```rust\n#[deriv= e(PartialEq, PartialOrd)]\nenum E {\n Top =3D 2,\n Bottom =3D 1,\n}\n= \nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?= \n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method= , with the others\ngenerated from default implementations.\n\nHowever it re= mains possible to implement the others separately for types which do not ha= ve a\ntotal order. For example, for floating point numbers, `NaN < 0 =3D=3D= false` and `NaN >=3D 0 =3D=3D\nfalse` (cf. IEEE 754-2008 section 5.11).\n\= n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`= Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse = std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n na= me: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn pa= rtial_cmp(&self, other: &Self) -> Option<Ordering> {\n Some(self.cmp= (other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self= ) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl P= artialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n se= lf.height =3D=3D other.height\n }\n}\n```\n\nYou may also find it useful= to use [`partial_cmp`] on your type's fields. Here\nis an example of `Pers= on` types who have a floating-point `height` field that\nis the only field = to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Perso= n {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOr= d for Person {\n fn partial_cmp(&self, other: &Self) -> Option<Ordering>= {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl Partia= lEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.he= ight =3D=3D other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u3= 2 =3D 0;\nlet y: u32 =3D 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y= ), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::c= mp") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "PartialOrd" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "PartialOrd") :additionalTextEdits []) (:label "Result" :kind 13 :detail "Result<{unknown}, {unknown}>" :docu= mentation (:kind "markdown" :value "`Result` is a type that represents either s= uccess ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](sel= f) for details.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Result" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Result") :additionalTextEdits []) (:label "RustcDecodable" :kind 18 :deprecated :json-false :preselect t= :sortText "ffffffef" :filterText "RustcDecodable" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "RustcDecodable") :additionalTextEdits []) (:label "RustcEncodable" :kind 18 :deprecated :json-false :preselect t= :sortText "ffffffef" :filterText "RustcEncodable" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "RustcEncodable") :additionalTextEdits []) (:label "Send" :kind 8 :documentation (:kind "markdown" :value "Types that can be transferred across thread= boundaries.\n\nThis trait is automatically implemented when the compiler d= etermines it's\nappropriate.\n\nAn example of a non-`Send` type is the refe= rence-counting pointer\n[`rc::Rc`][`Rc`]. If two threads attempt to clone [= `Rc`]s that point to the same\nreference-counted value, they might try to u= pdate the reference count at the\nsame time, which is [undefined behavior][= ub] because [`Rc`] doesn't use atomic\noperations. Its cousin [`sync::Arc`]= [arc] does use atomic operations (incurring\nsome overhead) and thus is `Se= nd`.\n\nSee [the Nomicon](../../nomicon/send-and-sync.html) and the [`Sync`= ] trait for more details.\n\n[`Rc`]: ../../std/rc/struct.Rc.html\n[arc]: ..= /../std/sync/struct.Arc.html\n[ub]: ../../reference/behavior-considered-und= efined.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Send" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Send") :additionalTextEdits []) (:label "Sized (alias ?)" :kind 8 :documentation (:kind "markdown" :value "Types with a constant size known at compile= time.\n\nAll type parameters have an implicit bound of `Sized`. The specia= l syntax\n`?Sized` can be used to remove this bound if it's not appropriate= .\n\n```rust\nstruct Foo<T>(T);\nstruct Bar<T: ?Sized>(T);\n\n// struct Foo= Use(Foo<[i32]>); // error: Sized is not implemented for [i32]\nstruct BarUs= e(Bar<[i32]>); // OK\n```\n\nThe one exception is the implicit `Self` type = of a trait. A trait does not\nhave an implicit `Sized` bound as this is inc= ompatible with [trait object]s\nwhere, by definition, the trait needs to wo= rk with all possible implementors,\nand thus could be any size.\n\nAlthough= Rust will let you bind `Sized` to a trait, you won't\nbe able to use it to= form a trait object later:\n\n```rust\ntrait Foo { }\ntrait Bar: Sized { }= \n\nstruct Impl;\nimpl Foo for Impl { }\nimpl Bar for Impl { }\n\nlet x: &d= yn Foo =3D &Impl; // OK\n// let y: &dyn Bar =3D &Impl; // error: the tra= it `Bar` cannot\n // be made into an object\n```= \n\n[trait object]: ../../book/ch17-02-trait-objects.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Sized" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Sized") :additionalTextEdits []) (:label "String" :kind 22 :detail "String" :documentation (:kind "markdown" :value "A UTF-8=E2=80=93encoded, growable string.\n= \n`String` is the most common string type. It has ownership over the conten= ts\nof the string, stored in a heap-allocated buffer (see [Representation](= #representation)).\nIt is closely related to its borrowed counterpart, the = primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a liter= al string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n= \n```rust\nlet hello =3D String::from(\"Hello, world!\");\n```\n\nYou can a= ppend a [`char`] to a `String` with the [`push`] method, and\nappend a [`&s= tr`] with the [`push_str`] method:\n\n```rust\nlet mut hello =3D String::fr= om(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`= push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vecto= r of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`]= method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart =3D vec!= [240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `un= wrap()`.\nlet sparkle_heart =3D String::from_utf8(sparkle_heart).unwrap();\= n\nassert_eq!(\"=F0=9F=92=96\", sparkle_heart);\n```\n\n[`from_utf8`]: Stri= ng::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a= non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the U= TF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are= typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std:= :mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = =3D \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same = contents would be longer because\n// every `char` is four bytes\nlet s =3D = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize =3D s.into_iter().map(|c| mem::= size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII= strings, the difference will be smaller\n// and sometimes they are the sam= e\nlet s =3D \"=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96= \";\nassert_eq!(s.len(), 20);\n\nlet s =3D ['=F0=9F=92=96', '=F0=9F=92=96',= '=F0=9F=92=96', '=F0=9F=92=96', '=F0=9F=92=96'];\nlet size: usize =3D s.in= to_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\= n\nThis raises interesting questions as to how `s[i]` should work.\nWhat sh= ould `i` be here? Several options include byte indices and\n`char` indices = but, because of UTF-8 encoding, only byte indices\nwould provide constant t= ime indexing. Getting the `i`th `char`, for\nexample, is available using [`= chars`]:\n\n```rust\nlet s =3D \"hello\";\nlet third_character =3D s.chars(= ).nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s =3D \"=F0=9F=92= =96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96\";\nlet third_character= =3D s.chars().nth(2);\nassert_eq!(third_character, Some('=F0=9F=92=96'));\= n```\n\nNext, what should `s[i]` return? Because indexing returns a referen= ce\nto underlying data it could be `&u8`, `&[u8]`, or something else simila= r.\nSince we're only providing one index, `&u8` makes the most sense but th= at\nmight not be what the user expects and can be explicitly achieved with\= n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `= 'h'`\nlet s =3D \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nasser= t_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obvio= usly useful\nlet s =3D \"=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96=F0=9F=92=96= =F0=9F=92=96\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these amb= iguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```= rust\nlet s =3D \"hello\";\n\n// The following will not compile!\nprintln!(= \"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, = how `&s[i..j]` should work (that is,\nindexing with a range). It should acc= ept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 = encoded. This is also called \"string slicing\".\nNote this will panic if t= he byte indices provided are not character\nboundaries - see [`is_char_boun= dary`] for more details. See the implementations\nfor [`SliceIndex<str>`] f= or more details on string slicing. For a non-panicking\nversion of string s= licing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"= ffi::OsString\"\n[`SliceIndex<str>`]: core::slice::SliceIndex\n[`as_bytes()= `]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_bo= undary\n\nThe [`bytes`] and [`chars`] methods return iterators over the byt= es and\ncodepoints of the string, respectively. To iterate over codepoints = along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[= `chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`St= ring` implements <code>[Deref]<Target =3D [str]></code>, and so inherits al= l of [`str`]'s\nmethods. In addition, this means that you can pass a `Strin= g` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n``= `rust\nfn takes_str(s: &str) { }\n\nlet s =3D String::from(\"Hello\");\n\nt= akes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pas= s it in. This\nconversion is very inexpensive, and so generally, functions = will accept\n[`&str`]s as arguments unless they need a `String` for some sp= ecific\nreason.\n\nIn certain cases Rust doesn't have enough information to= make this\nconversion, known as [`Deref`] coercion. In the following examp= le a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`,= and the function\n`example_func` takes anything that implements the trait.= In this case Rust\nwould need to make two implicit conversions, which Rust= doesn't have the\nmeans to do. For that reason, the following example will= not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample fo= r &'a str {}\n\nfn example_func<A: TraitExample>(example_arg: A) {}\n\nlet = example_string =3D String::from(\"example_string\");\nexample_func(&example= _string);\n```\n\nThere are two options that would work instead. The first = would be to\nchange the line `example_func(&example_string);` to\n`example_= func(example_string.as_str());`, using the method [`as_str()`]\nto explicit= ly extract the string slice containing the string. The second\nway changes = `example_func(&example_string);` to\n`example_func(&*example_string);`. In = this case we are dereferencing a\n`String` to a [`str`], then referencing t= he [`str`] back to\n[`&str`]. The second way is more idiomatic, however bot= h work to do the\nconversion explicitly rather than relying on the implicit= conversion.\n\n# Representation\n\nA `String` is made up of three componen= ts: a pointer to some bytes, a\nlength, and a capacity. The pointer points = to the internal buffer which `String`\nuses to store its data. The length i= s the number of bytes currently stored\nin the buffer, and the capacity is = the size of the buffer in bytes. As such,\nthe length will always be less t= han or equal to the capacity.\n\nThis buffer is always stored on the heap.\= n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nme= thods:\n\n```rust\nuse std::mem;\n\nlet story =3D String::from(\"Once upon = a time...\");\n\n// Prevent automatically dropping the String's data\nlet m= ut story =3D mem::ManuallyDrop::new(story);\n\nlet ptr =3D story.as_mut_ptr= ();\nlet len =3D story.len();\nlet capacity =3D story.capacity();\n\n// sto= ry has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String = out of ptr, len, and capacity. This is all\n// unsafe because we are respon= sible for making sure the components are\n// valid:\nlet s =3D unsafe { Str= ing::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"On= ce upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String:= :len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, = adding elements to it will not\nre-allocate. For example, consider this pro= gram:\n\n```rust\nlet mut s =3D String::new();\n\nprintln!(\"{}\", s.capaci= ty());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\",= s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8= \n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but = as we append to the\nstring, it increases its capacity appropriately. If we= instead use the\n[`with_capacity`] method to allocate the correct capacity= initially:\n\n```rust\nlet mut s =3D String::with_capacity(25);\n\nprintln= !(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n = println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::wit= h_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25= \n25\n25\n```\n\nHere, there's no need to allocate more memory inside the l= oop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@= str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::op= s::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "String" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "String") :additionalTextEdits []) (:label "Sync" :kind 8 :documentation (:kind "markdown" :value "Types for which it is safe to share referen= ces between threads.\n\nThis trait is automatically implemented when the co= mpiler determines\nit's appropriate.\n\nThe precise definition is: a type `= T` is [`Sync`] if and only if `&T` is\n[`Send`]. In other words, if there i= s no possibility of\n[undefined behavior][ub] (including data races) when p= assing\n`&T` references between threads.\n\nAs one would expect, primitive = types like [`u8`] and [`f64`]\nare all [`Sync`], and so are simple aggregat= e types containing them,\nlike tuples, structs and enums. More examples of = basic [`Sync`]\ntypes include \"immutable\" types like `&T`, and those with= simple\ninherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and= \nmost other collection types. (Generic parameters need to be [`Sync`]\nfor= their container to be [`Sync`].)\n\nA somewhat surprising consequence of t= he definition is that `&mut T`\nis `Sync` (if `T` is `Sync`) even though it= seems like that might\nprovide unsynchronized mutation. The trick is that = a mutable\nreference behind a shared reference (that is, `& &mut T`)\nbecom= es read-only, as if it were a `& &T`. Hence there is no risk\nof a data rac= e.\n\nA shorter overview of how [`Sync`] and [`Send`] relate to referencing= :\n* `&T` is [`Send`] if and only if `T` is [`Sync`]\n* `&mut T` is [`Send`= ] if and only if `T` is [`Send`]\n* `&T` and `&mut T` are [`Sync`] if and o= nly if `T` is [`Sync`]\n\nTypes that are not `Sync` are those that have \"i= nterior\nmutability\" in a non-thread-safe form, such as [`Cell`][cell]\nan= d [`RefCell`][refcell]. These types allow for mutation of\ntheir contents e= ven through an immutable, shared reference. For\nexample the `set` method o= n [`Cell<T>`][cell] takes `&self`, so it requires\nonly a shared reference = [`&Cell<T>`][cell]. The method performs no\nsynchronization, thus [`Cell`][= cell] cannot be `Sync`.\n\nAnother example of a non-`Sync` type is the refe= rence-counting\npointer [`Rc`][rc]. Given any reference [`&Rc<T>`][rc], you= can clone\na new [`Rc<T>`][rc], modifying the reference counts in a non-at= omic way.\n\nFor cases when one does need thread-safe interior mutability,\= nRust provides [atomic data types], as well as explicit locking via\n[`sync= ::Mutex`][mutex] and [`sync::RwLock`][rwlock]. These types\nensure that any= mutation cannot cause data races, hence the types\nare `Sync`. Likewise, [= `sync::Arc`][arc] provides a thread-safe\nanalogue of [`Rc`][rc].\n\nAny ty= pes with interior mutability must also use the\n[`cell::UnsafeCell`][unsafe= cell] wrapper around the value(s) which\ncan be mutated through a shared re= ference. Failing to doing this is\n[undefined behavior][ub]. For example, [= `transmute`][transmute]-ing\nfrom `&T` to `&mut T` is invalid.\n\nSee [the = Nomicon][nomicon-send-and-sync] for more details about `Sync`.\n\n[box]: ..= /../std/boxed/struct.Box.html\n[vec]: ../../std/vec/struct.Vec.html\n[cell]= : crate::cell::Cell\n[refcell]: crate::cell::RefCell\n[rc]: ../../std/rc/st= ruct.Rc.html\n[arc]: ../../std/sync/struct.Arc.html\n[atomic data types]: c= rate::sync::atomic\n[mutex]: ../../std/sync/struct.Mutex.html\n[rwlock]: ..= /../std/sync/struct.RwLock.html\n[unsafecell]: crate::cell::UnsafeCell\n[ub= ]: ../../reference/behavior-considered-undefined.html\n[transmute]: crate::= mem::transmute\n[nomicon-send-and-sync]: ../../nomicon/send-and-sync.html") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Sync" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Sync") :additionalTextEdits []) (:label "ToOwned" :kind 8 :documentation (:kind "markdown" :value "A generalization of `Clone` to borrowed dat= a.\n\nSome types make it possible to go from borrowed to owned, usually by\= nimplementing the `Clone` trait. But `Clone` works only for going from `&T`= \nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\n= from any borrow of a given type.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ToOwned" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ToOwned") :additionalTextEdits []) (:label "ToString" :kind 8 :documentation (:kind "markdown" :value "A trait for converting a value to a `String= `.\n\nThis trait is automatically implemented for any type which implements= the\n[`Display`] trait. As such, `ToString` shouldn't be implemented direc= tly:\n[`Display`] should be implemented instead, and you get the `ToString`= \nimplementation for free.\n\n[`Display`]: fmt::Display") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "ToString" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "ToString") :additionalTextEdits []) (:label "TryFrom" :kind 8 :documentation (:kind "markdown" :value "Simple and safe type conversions that may f= ail in a controlled\nway under some circumstances. It is the reciprocal of = [`TryInto`].\n\nThis is useful when you are doing a type conversion that ma= y\ntrivially succeed but may also need special handling.\nFor example, ther= e is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait= , because an [`i64`] may contain a value\nthat an [`i32`] cannot represent = and so the conversion would lose data.\nThis might be handled by truncating= the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some= other method. The [`From`]\ntrait is intended for perfect conversions, so= the `TryFrom` trait\ninforms the programmer when a type conversion could g= o bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\= n\n- `TryFrom<T> for U` implies [`TryInto`]`<U> for T`\n- [`try_from`] is r= eflexive, which means that `TryFrom<T> for T`\nis implemented and cannot fa= il -- the associated `Error` type for\ncalling `T::try_from()` on a value o= f type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallib= le`] and [`!`] will be\nequivalent.\n\n`TryFrom<T>` can be implemented as f= ollows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom<i32> for G= reaterThanZero {\n type Error =3D &'static str;\n\n fn try_from(value= : i32) -> Result<Self, Self::Error> {\n if value <=3D 0 {\n = Err(\"GreaterThanZero only accepts values greater than zero!\")\n = } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```= \n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\= n```rust\nlet big_number =3D 1_000_000_000_000i64;\n// Silently truncates `= big_number`, requires detecting\n// and handling the truncation after the f= act.\nlet smaller_number =3D big_number as i32;\nassert_eq!(smaller_number,= -727379968);\n\n// Returns an error because `big_number` is too big to\n//= fit in an `i32`.\nlet try_smaller_number =3D i32::try_from(big_number);\na= ssert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_succes= sful_smaller_number =3D i32::try_from(3);\nassert!(try_successful_smaller_n= umber.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "TryFrom" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "TryFrom") :additionalTextEdits []) (:label "TryInto" :kind 8 :documentation (:kind "markdown" :value "An attempted conversion that consumes `self= `, which may or may not be\nexpensive.\n\nLibrary authors should usually no= t directly implement this trait,\nbut should prefer implementing the [`TryF= rom`] trait, which offers\ngreater flexibility and provides an equivalent `= TryInto`\nimplementation for free, thanks to a blanket implementation in th= e\nstandard library. For more information on this, see the\ndocumentation f= or [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restricti= ons and reasoning as implementing\n[`Into`], see there for details.") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "TryInto" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "TryInto") :additionalTextEdits []) (:label "Unpin" :kind 8 :documentation (:kind "markdown" :value "Types that do not require any pinning guara= ntees.\n\nFor information on what \"pinning\" is, see the [`pin` module] do= cumentation.\n\nImplementing the `Unpin` trait for `T` expresses the fact t= hat `T` is pinning-agnostic:\nit shall not expose nor rely on any pinning g= uarantees. This, in turn, means that a\n`Pin`-wrapped pointer to such a typ= e can feature a *fully unrestricted* API.\nIn other words, if `T: Unpin`, a= value of type `T` will *not* be bound by the invariants\nwhich pinning oth= erwise offers, even when \"pinned\" by a [`Pin<Ptr>`] pointing at it.\nWhen= a value of type `T` is pointed at by a [`Pin<Ptr>`], [`Pin`] will not rest= rict access\nto the pointee value like it normally would, thus allowing the= user to do anything that they\nnormally could with a non-[`Pin`]-wrapped `= Ptr` to that value.\n\nThe idea of this trait is to alleviate the reduced e= rgonomics of APIs that require the use\nof [`Pin`] for soundness for some t= ypes, but which also want to be used by other types that\ndon't care about = pinning. The prime example of such an API is [`Future::poll`]. There are ma= ny\n[`Future`] types that don't care about pinning. These futures can imple= ment `Unpin` and\ntherefore get around the pinning related restrictions in = the API, while still allowing the\nsubset of [`Future`]s which *do* require= pinning to be implemented soundly.\n\nFor more discussion on the consequen= ces of [`Unpin`] within the wider scope of the pinning\nsystem, see the [se= ction about `Unpin`] in the [`pin` module].\n\n`Unpin` has no consequence a= t all for non-pinned data. In particular, [`mem::replace`] happily\nmoves `= !Unpin` data, which would be immovable when pinned ([`mem::replace`] works = for any\n`&mut T`, not just when `T: Unpin`).\n\n*However*, you cannot use = [`mem::replace`] on `!Unpin` data which is *pinned* by being wrapped\ninsid= e a [`Pin<Ptr>`] pointing at it. This is because you cannot (safely) use a\= n[`Pin<Ptr>`] to get an `&mut T` to its pointee value, which you would need= to call\n[`mem::replace`], and *that* is what makes this system work.\n\nS= o this, for example, can only be done on types implementing `Unpin`:\n\n```= rust\nuse std::mem;\nuse std::pin::Pin;\n\nlet mut string =3D \"this\".to_s= tring();\nlet mut pinned_string =3D Pin::new(&mut string);\n\n// We need a = mutable reference to call `mem::replace`.\n// We can obtain such a referenc= e by (implicitly) invoking `Pin::deref_mut`,\n// but that is only possible = because `String` implements `Unpin`.\nmem::replace(&mut *pinned_string, \"o= ther\".to_string());\n```\n\nThis trait is automatically implemented for al= most every type. The compiler is free\nto take the conservative stance of m= arking types as [`Unpin`] so long as all of the types that\ncompose its fie= lds are also [`Unpin`]. This is because if a type implements [`Unpin`], the= n it\nis unsound for that type's implementation to rely on pinning-related = guarantees for soundness,\n*even* when viewed through a \"pinning\" pointer= ! It is the responsibility of the implementor of\na type that relies upon p= inning for soundness to ensure that type is *not* marked as [`Unpin`]\nby a= dding [`PhantomPinned`] field. For more details, see the [`pin` module] doc= s.\n\n[`mem::replace`]: crate::mem::replace \"mem replace\"\n[`Future`]: cr= ate::future::Future \"Future\"\n[`Future::poll`]: crate::future::Future::po= ll \"Future poll\"\n[`Pin`]: crate::pin::Pin \"Pin\"\n[`Pin<Ptr>`]: crate::= pin::Pin \"Pin\"\n[`pin` module]: crate::pin \"pin module\"\n[section about= `Unpin`]: crate::pin#unpin \"pin module docs about unpin\"\n[`unsafe`]: ..= /../std/keyword.unsafe.html \"keyword unsafe\"") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Unpin" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Unpin") :additionalTextEdits []) (:label "Vec" :kind 22 :detail "Vec<{unknown}, {unknown}>" :documentat= ion (:kind "markdown" :value "A contiguous growable array type, written a= s `Vec<T>`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec =3D V= ec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert= _eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), = 1);\n\nvec[0] =3D 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nf= or x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n= ```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```= rust\nlet mut vec1 =3D vec![1, 2, 3];\nvec1.push(4);\nlet vec2 =3D Vec::fro= m([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize ea= ch element of a `Vec<T>` with a given value.\nThis may be more efficient th= an performing allocation and initialization\nin separate steps, especially = when initializing a vector of zeros:\n\n```rust\nlet vec =3D vec![0; 5];\na= ssert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but pot= entially slower:\nlet mut vec =3D Vec::with_capacity(5);\nvec.resize(5, 0);= \nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Cap= acity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec<T>` as a= n efficient stack:\n\n```rust\nlet mut stack =3D Vec::new();\n\nstack.push(= 1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) =3D stack.pop() = {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\= nThe `Vec` type allows access to values by index, because it implements the= \n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v =3D = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nH= owever be careful: if you try to access an index which isn't in the `Vec`,\= nyour software will panic! You cannot do this:\n\n```rust\nlet v =3D vec![0= , 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] = and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\= n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-on= ly objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\n= fn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v =3D vec![0, 1];\nr= ead_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\= nlet u: &[usize] =3D &v;\n// or like this:\nlet u: &[_] =3D &v;\n```\n\nIn = Rust, it's more common to pass slices as arguments rather than vectors\nwhe= n you just want to provide read access. The same goes for [`String`] and\n[= `&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the = amount of space allocated for any future\nelements that will be added onto = the vector. This is not to be confused with\nthe *length* of a vector, whic= h specifies the number of actual elements\nwithin the vector. If a vector's= length exceeds its capacity, its capacity\nwill automatically be increased= , but its elements will have to be\nreallocated.\n\nFor example, a vector w= ith capacity 10 and length 0 would be an empty vector\nwith space for 10 mo= re elements. Pushing 10 or fewer elements onto the\nvector will not change = its capacity or cause reallocation to occur. However,\nif the vector's leng= th is increased to 11, it will have to reallocate, which\ncan be slow. For = this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever poss= ible to specify how big the vector is expected to get.\n\n# Guarantees\n\nD= ue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\na= bout its design. This ensures that it's as low-overhead as possible in\nthe= general case, and can be correctly manipulated in primitive ways\nby unsaf= e code. Note that these guarantees refer to an unqualified `Vec<T>`.\nIf ad= ditional type parameters are added (e.g., to support custom allocators),\no= verriding their defaults may change the behavior.\n\nMost fundamentally, `V= ec` is and always will be a (pointer, capacity, length)\ntriplet. No more, = no less. The order of these fields is completely\nunspecified, and you shou= ld use the appropriate methods to modify these.\nThe pointer will never be = null, so this type is null-pointer-optimized.\n\nHowever, the pointer might= not actually point to allocated memory. In particular,\nif you construct a= `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_c= apacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an = empty Vec, it will not allocate memory. Similarly, if you store zero-sized\= ntypes inside a `Vec`, it will not allocate space for them. *Note that in t= his case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will alloc= ate if and only\nif <code>[mem::size_of::\\<T>]\\() * [capacity]\\() > 0</c= ode>. In general, `Vec`'s allocation\ndetails are very subtle --- if you in= tend to allocate memory using a `Vec`\nand use it for something else (eithe= r to pass to unsafe code, or to build your\nown memory-backed collection), = be sure to deallocate this memory by using\n`from_raw_parts` to recover the= `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the= memory it points to is on the heap\n(as defined by the allocator Rust is c= onfigured to use by default), and its\npointer points to [`len`] initialize= d, contiguous elements in order (what\nyou would see if you coerced it to a= slice), followed by <code>[capacity] - [len]</code>\nlogically uninitializ= ed, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'= ` with capacity 4 can be\nvisualized as below. The top part is the `Vec` st= ruct, it contains a\npointer to the head of the allocation in the heap, len= gth and capacity.\nThe bottom part is the allocation on the heap, a contigu= ous memory block.\n\n```text\n ptr len capacity\n +-= -------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--= ------+--------+--------+\n |\n v\nHeap +--------+-= -------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n = +--------+--------+--------+--------+\n```\n\n- **uninit** represents= memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is n= ot stable and `Vec` makes no guarantees about its memory\n layout (includi= ng the order of fields).\n\n`Vec` will never perform a \"small optimization= \" where elements are actually\nstored on the stack for two reasons:\n\n* I= t would make it more difficult for unsafe code to correctly manipulate\n a= `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n= only moved, and it would be more difficult to determine if a `Vec` had\n = actually allocated memory.\n\n* It would penalize the general case, incurr= ing an additional branch\n on every access.\n\n`Vec` will never automatica= lly shrink itself, even if completely empty. This\nensures no unnecessary a= llocations or deallocations occur. Emptying a `Vec`\nand then filling it ba= ck up to the same [`len`] should incur no calls to\nthe allocator. If you w= ish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[= `push`] and [`insert`] will never (re)allocate if the reported capacity is\= nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n<code>[len] = =3D=3D [capacity]</code>. That is, the reported capacity is completely\nacc= urate, and can be relied on. It can even be used to manually free the memor= y\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate= , even\nwhen not necessary.\n\n`Vec` does not guarantee any particular grow= th strategy when reallocating\nwhen full, nor when [`reserve`] is called. T= he current strategy is basic\nand it may prove desirable to use a non-const= ant growth factor. Whatever\nstrategy is used will of course guarantee *O*(= 1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::wit= h_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith at le= ast the requested capacity. If <code>[len] =3D=3D [capacity]</code>,\n(as i= s the case for the [`vec!`] macro), then a `Vec<T>` can be converted to\nan= d from a [`Box<[T]>`][owned slice] without reallocating or moving the eleme= nts.\n\n`Vec` will not specifically overwrite any data that is removed from= it,\nbut also won't specifically preserve it. Its uninitialized memory is\= nscratch space that it may use however it wants. It will generally just do\= nwhatever is most efficient or otherwise easy to implement. Do not rely on\= nremoved data to be erased for security purposes. Even if you drop a `Vec`,= its\nbuffer may simply be reused by another allocation. Even if you zero a= `Vec`'s memory\nfirst, that might not actually happen because the optimize= r does not consider\nthis a side-effect that must be preserved. There is on= e case which we will\nnot break, however: using `unsafe` code to write to t= he excess capacity,\nand then increasing the length to match, is always val= id.\n\nCurrently, `Vec` does not guarantee the order in which elements are = dropped.\nThe order has changed in the past and may change again.\n\n[`get`= ]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::Stri= ng\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`= ]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n= [mem::size_of::\\<T>]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::l= en\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve= \n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box") :deprecated :json-false :preselect t :sortText "ffffffef" :filterText= "Vec" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "Vec") :additionalTextEdits []) (:label "alloc_error_handler" :kind 18 :deprecated :json-false :presel= ect t :sortText "ffffffef" :filterText "alloc_error_handler" :textEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "alloc_error_handler") :additionalTextEdits [])])) [client-notification] Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :method "textDocument/didChange" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs" :version 1) :contentChanges [(:range (:start (:line 4 :character 17) :end (:line 4 :character 17)) :rangeLength 0 :text " (use std::collections::HashSet)")])) [client-request] (id:13) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 13 :method "completionItem/resolve" :params (:label #("HashSet (use std::collections::HashSet)" 0 1 (eglot--lsp-item #1)) :kind 22 :detail "HashSet<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` where= the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires t= hat the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freque= ntly be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you impleme= nt these yourself,\nit is important that the following property holds:\n\n`= ``text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, if= two keys are equal, their hashes must be equal.\nViolating this property i= s a logic error.\n\nIt is also a logic error for a key to be modified in su= ch a way that the key's\nhash, as determined by the [`Hash`] trait, or its = equality, as determined by\nthe [`Eq`] trait, changes while it is in the ma= p. This is normally only\npossible through [`Cell`], [`RefCell`], global st= ate, I/O, or unsafe code.\n\nThe behavior resulting from either logic error= is not specified, but will\nbe encapsulated to the `HashSet` that observed= the logic error and not\nresult in undefined behavior. This could include = panics, incorrect results,\naborts, memory leaks, and non-termination.\n\n#= Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference let= s us omit an explicit type signature (which\n// would be `HashSet<String>` = in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books.\= nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To Kil= l a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string());= \nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a specifi= c one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We ha= ve {} books, but The Winds of Winter ain't one.\",\n books.len(= ));\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate o= ver everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\n\= nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`] a= nd [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`Eq`= ] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a known= list of items can be initialized from an array:\n\n```rust\nuse std::colle= ctions::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\"= , \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-variant-= of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`RefC= ell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :tex= tEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [] :data (:position (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17)) :imports [(:full_import_path "std::collections::HashSet" :imported_name "HashSe= t")] :version 0))) [client-notification] Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :method "workspace/didChangeWatchedFiles" :params (:changes [(:uri "file:///home/brennan/test_rust/src/brennan@HIDDEN%3A172= 6418014" :type 1)])) [server-reply] (id:13) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 13 :result (:label "HashSet (use std::collections::HashSet)" :kind 22 :detail "Hash= Set<{unknown}, {unknown}>" :documentation (:kind "markdown" :value "A [hash set] implemented as a `HashMap` where= the value is `()`.\n\nAs with the [`HashMap`] type, a `HashSet` requires t= hat the elements\nimplement the [`Eq`] and [`Hash`] traits. This can freque= ntly be achieved by\nusing `#[derive(PartialEq, Eq, Hash)]`. If you impleme= nt these yourself,\nit is important that the following property holds:\n\n`= ``text\nk1 =3D=3D k2 -> hash(k1) =3D=3D hash(k2)\n```\n\nIn other words, if= two keys are equal, their hashes must be equal.\nViolating this property i= s a logic error.\n\nIt is also a logic error for a key to be modified in su= ch a way that the key's\nhash, as determined by the [`Hash`] trait, or its = equality, as determined by\nthe [`Eq`] trait, changes while it is in the ma= p. This is normally only\npossible through [`Cell`], [`RefCell`], global st= ate, I/O, or unsafe code.\n\nThe behavior resulting from either logic error= is not specified, but will\nbe encapsulated to the `HashSet` that observed= the logic error and not\nresult in undefined behavior. This could include = panics, incorrect results,\naborts, memory leaks, and non-termination.\n\n#= Examples\n\n```rust\nuse std::collections::HashSet;\n// Type inference let= s us omit an explicit type signature (which\n// would be `HashSet<String>` = in this example).\nlet mut books =3D HashSet::new();\n\n// Add some books.\= nbooks.insert(\"A Dance With Dragons\".to_string());\nbooks.insert(\"To Kil= l a Mockingbird\".to_string());\nbooks.insert(\"The Odyssey\".to_string());= \nbooks.insert(\"The Great Gatsby\".to_string());\n\n// Check for a specifi= c one.\nif !books.contains(\"The Winds of Winter\") {\n println!(\"We ha= ve {} books, but The Winds of Winter ain't one.\",\n books.len(= ));\n}\n\n// Remove a book.\nbooks.remove(\"The Odyssey\");\n\n// Iterate o= ver everything.\nfor book in &books {\n println!(\"{book}\");\n}\n```\n\= nThe easiest way to use `HashSet` with a custom type is to derive\n[`Eq`] a= nd [`Hash`]. We must also derive [`PartialEq`],\nwhich is required if [`Eq`= ] is derived.\n\n```rust\nuse std::collections::HashSet;\n#[derive(Hash, Eq= , PartialEq, Debug)]\nstruct Viking {\n name: String,\n power: usize,= \n}\n\nlet mut vikings =3D HashSet::new();\n\nvikings.insert(Viking { name:= \"Einar\".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Einar= \".to_string(), power: 9 });\nvikings.insert(Viking { name: \"Olaf\".to_str= ing(), power: 4 });\nvikings.insert(Viking { name: \"Harald\".to_string(), = power: 8 });\n\n// Use derived implementation to print the vikings.\nfor x = in &vikings {\n println!(\"{x:?}\");\n}\n```\n\nA `HashSet` with a known= list of items can be initialized from an array:\n\n```rust\nuse std::colle= ctions::HashSet;\n\nlet viking_names =3D HashSet::from([\"Einar\", \"Olaf\"= , \"Harald\"]);\n```\n\n[hash set]: crate::collections#use-the-set-variant-= of-any-of-these-maps-when\n[`HashMap`]: crate::collections::HashMap\n[`RefC= ell`]: crate::cell::RefCell\n[`Cell`]: crate::cell::Cell") :deprecated :json-false :sortText "fffffff0" :filterText "HashSet" :tex= tEdit (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :newText "HashSet") :additionalTextEdits [])) [client-notification] Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :method "textDocument/didChange" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs" :version 4) :contentChanges [(:range (:start (:line 4 :character 17) :end (:line 4 :character 49)) :rangeLength 32 :text "") (:range (:start (:line 4 :character 10) :end (:line 4 :character 17)) :rangeLength 7 :text "") (:range (:start (:line 4 :character 10) :end (:line 4 :character 10)) :rangeLength 0 :text "HashSet")])) [client-request] (id:14) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 14 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:15) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 15 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:16) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 16 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [server-reply] (id:15) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 15 :result nil) [server-reply] (id:16) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 16 :result nil) [server-reply] (id:14) Mon Sep 16 12:50:08 2024: (:jsonrpc "2.0" :id 14 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [client-request] (id:17) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 17 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:18) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 18 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:19) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 19 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:20) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 20 :method "textDocument/inlayHint" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :range (:start (:line 4 :character 0) :end (:line 8 :character 0)))) [server-reply] (id:17) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 17 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:18) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 18 :result nil) [server-reply] (id:19) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 19 :result nil) [server-reply] (id:20) Mon Sep 16 12:50:09 2024: (:jsonrpc "2.0" :id 20 :result []) [client-request] (id:21) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 21 :method "textDocument/signatureHelp" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:22) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 22 :method "textDocument/hover" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [client-request] (id:23) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 23 :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/brennan/test_rust/src/main.rs") :position (:line 4 :character 17))) [server-reply] (id:21) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 21 :result (:signatures [(:label "struct S<T>" :parameters [(:label [9 10])] :activeParameter 0)] :activeSignature 0 :activeParameter 0)) [server-reply] (id:22) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 22 :result nil) [server-reply] (id:23) Mon Sep 16 12:50:11 2024: (:jsonrpc "2.0" :id 23 :result nil) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > It should highlight what has changed in the client-server > communication, if anything. > > Jo=C3=A3o --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 16:21:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 12:21:18 2024 Received: from localhost ([127.0.0.1]:53142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqETW-0001LG-1X for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 12:21:18 -0400 Received: from mail-oo1-f50.google.com ([209.85.161.50]:61877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1sqETU-0001Ko-HB for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 12:21:17 -0400 Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5daa93677e1so2413344eaf.3 for <73279 <at> debbugs.gnu.org>; Mon, 16 Sep 2024 09:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726503596; x=1727108396; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WGwYciY86OWeRZ5Rb5XIU7kzNHWtOgoHG/D5YAGCwpw=; b=a4U5LH5Flu5ikH5XvM4Ed2iVP8HUQ2wjt8/Q7IsH/0EcTq9C26XBsq9693UMau3rAP F+OZa6NYVVcwrklQEQpOjtrppPcWXCULiHdNBP7nIowp87oYFNF2zwVutYKDLWupmFDL 7kAH+sEmChos4aj+Lfgg96PSGQAgJF9b7RhxKH9VvMbvDZ0zubPjJDjt3pGNpEKzPBVr 3WawR4qTefkFs7DrFQoTzSui+NHpaMUKfanIBNGuR5bvNBXuFAmozK/+E9qtscrP2ShP lnTmK19Fr2TqeUQmib8F9i9YUpJfBccSnaHQglYC3z9mategSIxP4JlVZ2PUfi79aI3t nnxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726503596; x=1727108396; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WGwYciY86OWeRZ5Rb5XIU7kzNHWtOgoHG/D5YAGCwpw=; b=SQWx/KY4DeSJEHWQjgtN05e1+/e2cQpfmLQQza9EENcqJXgctuPCrlm8K14MYHP3u1 gUXvSWF4W2NjWHyaiEAnj4Z7ctqJ0faC41zPPgok0UjyMF//7M6x7aGYbSM0wxU/98ZK 4y4IyeRttle2DcJzTjK1f/MsQe1vOVFMBHJw5M386fGO8XQ8tkA1CPMPFl7jJgjNtqNx LJL0vPyTUJPYAq++W8nmDnUjAj7T7CfAdRanR96FEoI1degWTW3mY9xol9cHI+2QvEvn 87S6sntpoOkIiDsCnulfUtkUnuuf5AZqXLExyKQd6cGMIGoG3eVQs+sQzZ+GSzUK+vT5 hFqg== X-Forwarded-Encrypted: i=1; AJvYcCVhdfaTIX+z7LNu2bGUXDgUet5hvhoYNMnNgIWXNlPuP+ZgsMCiJ7MQsVp287zMzAgr7YkJOg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyuBQ2dPvpTLrhMTkJ13JPyskTOMnvS+ZVxF5O1R9aLzP7YXVrT bmZSB4HZmpIyJuOYMFXaUPtuTIiN+X5YhIVhTewb90rTO9XTJ8eD9AfyEQshEa1I/nGabSjiVvQ Zg7RaVcPJ0YXlqcIMPCh1uYO4ElU= X-Google-Smtp-Source: AGHT+IHv5Nejya/iwNPkxPYXPabkFnloT/7Z9U1rc8gI4a7cH4aXM41t/MtFQcMXStqtB8HYCaPHKio8u8RfZqD2wx4= X-Received: by 2002:a05:6820:16a8:b0:5e1:e1a4:add1 with SMTP id 006d021491bc7-5e20145f832mr7479316eaf.7.1726503596256; Mon, 16 Sep 2024 09:19:56 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> In-Reply-To: <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Mon, 16 Sep 2024 17:21:21 +0100 Message-ID: <CALDnm52dHFdYUme---TU30wqV1jWSXaV8fVa+xjafibCCEGd_g@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Mon, Sep 16, 2024 at 4:50=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@g= mail.com> wrote: > > On Mon, Sep 16, 2024 at 4:40=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora= @gmail.com> wrote: > > > > On Mon, Sep 16, 2024 at 4:17=E2=80=AFPM Brennan Vincent <brennan@umanwi= zard.com> wrote: > > > > > As for the regression: yes, it's a regression from 29.4, and in fact = I > > > have bisected to the commit that regressed it: > > > a8c1559a663d9bc21776e33303251e244f86f0d7 > > > > Oh alright, that clears it up. It was an oversight indeed, so I think > > your patch is TRT. I'll install it in emacs-30. > > Actually, not so fast. The code before that allegedly broken commit > _also_ sent outstanding changes to the server before resolving > (via the advice that was then removed). > > So I must be missing something, and must investigate more > closely. Brennan, can you provide an excerpt of the Eglot event log (M-x eglot-events-buffer) for your MRE recipe before and after a8c1559a663d9bc21776e33303251e244f86f0d7? It should highlight what has changed in the client-server communication, if anything. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 15:50:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 11:50:31 2024 Received: from localhost ([127.0.0.1]:53101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqDzj-00081t-0k for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:50:31 -0400 Received: from mail-oo1-f48.google.com ([209.85.161.48]:55349) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1sqDzh-00081e-C8 for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:50:30 -0400 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5d5f24d9df8so1507788eaf.2 for <73279 <at> debbugs.gnu.org>; Mon, 16 Sep 2024 08:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726501750; x=1727106550; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HN/2lt1YPPANqmDrEMUgEtCyznqSmVOl2Sw+dNjXtxo=; b=jgnFyNftsI0y8noRVjG+IQHbOtvWDnXhSmnbBmB5TKAwh2auEj3MPW9KNeo2p8EXif 57FVwJpJdsuMkKjyxiaTnU6x3wBrHCOlXki7sgNYhf8v0eq2R142ss6s6Lr8lnV1LtMI dZ3OzBcg828wRafuoThXJRkH3vWfKOaQiO89t7tfHPEExG0/0DjRNRIj9rHSDdIhkzFL wpd9tNZsjzRyVyddl4N2CetJZDU205THa/6OkWsjFVPt3ycm2D0ttkHZKDst91WH7qzh 4XfjKyJuxec01cfS2bkxNXrXS8CzULUvE9MMxE7K748z4fdSBVU/Jv/myVgunoTs0QEy D5fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726501750; x=1727106550; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HN/2lt1YPPANqmDrEMUgEtCyznqSmVOl2Sw+dNjXtxo=; b=Gbb8yr0Goqvu8aheEg9YPznTgD9L/O/VOe30DdL3sB01UuCbwrcXrhF/r7FOAwpm5Q 18MFqOLe1NqGlBeuYRKEwFUt+2igdtqgBtugcT5kQ5BzhyLxj19W+h/wHEpobuIgsdIq hsVyd+rs6iXEHfiTV99msajShGZqVWh9iueQLmOKWgluBkX1d3vNRv+2v6qVrBLnQC6V JBjjx6t8WHeXINmHI+OrAmwqv4a5gTgzQ52ymngGvw0wRUsCfYi3wRmqXhuiO/amqAp2 IVzLd7umZCy6w2yeSpEFz5Qch2twxt3nxd5MDaBI7NKezYwNzTRzA4bvg8ZXOoK6ar6H SBKw== X-Forwarded-Encrypted: i=1; AJvYcCUwPzCdtRs1K+qriY9BrAvWZqqdETAo3QKll55OXizFxJtJvjpz9VjXajV8nTZZaPIRPz0I2Q==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzmCEgAbRSIi2fCP3wicpkZlRuFN/2TICL/a2XSGkl85VdhkmR8 S3soLULLKMCaS5n5d5q1k4r9yt2K4tdSegyIWzrEeGsJGw26uyvjzwvPfuc7zL2uCMfHcRZAFXz ZQ95bcSKmuKfOzqSnh3qI50W5Xk2/eA== X-Google-Smtp-Source: AGHT+IFGRAXNyzfy2PXsbKa8quWFgTPdnqHOazHayIykfuwOcjj2CNLKLYeP8l+Jw9EH1vvJSXlFDSrWB0Zo3bB66Jg= X-Received: by 2002:a05:6820:160a:b0:5e1:cabe:a3 with SMTP id 006d021491bc7-5e20bfc6df9mr4405653eaf.0.1726501750335; Mon, 16 Sep 2024 08:49:10 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> In-Reply-To: <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Mon, 16 Sep 2024 16:50:35 +0100 Message-ID: <CALDnm50HsJYLVSTUpSuVTJmjky5iiFcooSrYynvGRhPzhcYT_Q@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Mon, Sep 16, 2024 at 4:40=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@g= mail.com> wrote: > > On Mon, Sep 16, 2024 at 4:17=E2=80=AFPM Brennan Vincent <brennan@umanwiza= rd.com> wrote: > > > As for the regression: yes, it's a regression from 29.4, and in fact I > > have bisected to the commit that regressed it: > > a8c1559a663d9bc21776e33303251e244f86f0d7 > > Oh alright, that clears it up. It was an oversight indeed, so I think > your patch is TRT. I'll install it in emacs-30. Actually, not so fast. The code before that allegedly broken commit _also_ sent outstanding changes to the server before resolving (via the advice that was then removed). So I must be missing something, and must investigate more closely. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 15:39:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 11:39:58 2024 Received: from localhost ([127.0.0.1]:53085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqDpW-0007JW-0C for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:39:58 -0400 Received: from mail-oo1-f48.google.com ([209.85.161.48]:59874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1sqDpT-0007JC-F8 for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:39:56 -0400 Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5da6865312eso2315069eaf.3 for <73279 <at> debbugs.gnu.org>; Mon, 16 Sep 2024 08:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726501116; x=1727105916; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=76BNfy7kD1cB16/Pf+71aGkjLvnLqfKZJfUHRnPqxCI=; b=O68HADuwaXTktq0FeKdoFUY8fxY0kJtzpEpp9oLIu5YWqWimDTNuIACr3ta6AsCsBA a2v3IjZHEDt1ecC8LchmVVh2dJEo/2hS+Xvxs1DH28phObqrwAipIw3O5SfcB03rAtrq JSamiPBfAtUxrWV+q10g6h2HyBozlx61TUODS4yt51sTfNKyrqwyaKyKY8vN5vkL0dmq Ks8pQk22Py/5ay24xMKorU/N7/DoAtxGncPsh4JFryrNZzmLniZ5VtDy29MWauRRfQrH fK3owW3Ot9mIRVbSmlHeqcz4rjci03sxC+RRrLtnpyKPpDoyCBwx/1F0Mcx9TI7EyvOK +SCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726501116; x=1727105916; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=76BNfy7kD1cB16/Pf+71aGkjLvnLqfKZJfUHRnPqxCI=; b=BETebipJZdCUf1rpGvEx9lbZorPUAsBPnKbtLSJWvXRrtOYCJ+UPVzJP50EvXo6/o4 THRJgGc8lkdMnpdZ2REfcHfNPr2TDhkpFzxFv/lcfnaVqQcPntqhiL9Il2jY1BczmXNJ PdQG0ED+d9tilyqNssGe4LgofS2vVroGlVSK87T9xLNEHfFHwYrK4SJBArGXqK7Zl/U+ o0S6D20dAgp/IK6LSIiJSU2XTm1RCvjJgaJvP4qVV4c0luBJWH+3id5iBtNdDL/8iw1y dYpPkHCgBd0nw2DD8V9J5wew68fViloywp1Y14qHh9HOM3oxi0ACNRvZ4MhQGXlskt70 b1Vg== X-Forwarded-Encrypted: i=1; AJvYcCWTpdw0cgL+26Ta+D66Y6/YHRxCgFYYqpklc8Y73NR/1J27J8MJyv6mySIdyhhwRDQmuroN6Q==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yx6NIuGNdD6760OrYMJVeZXSwKkyTF5pL+YaFDdFetHer793H1e hmyw+hEZ1zVaN/TacScJkRZFrtdLyR+QCR462B32mjbkEX2yXwU4rmgm6a+zBllRKlrB/ayzPSG lpdxFS4m+HYI66/Rx+UrHbdpFL+c= X-Google-Smtp-Source: AGHT+IEh6Q3JEa+3L5Je4ce/Ta3hM21Ttnwmoj9ZBC/Bmr5CZgJc1euQe1tpgYcgvRmJwM4vLs41A1Bhcowlcp/YCpw= X-Received: by 2002:a05:6820:1c98:b0:5e1:e748:7ad with SMTP id 006d021491bc7-5e2014564c3mr9355013eaf.7.1726501116391; Mon, 16 Sep 2024 08:38:36 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> <8734lz7hn2.fsf@HIDDEN> In-Reply-To: <8734lz7hn2.fsf@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Mon, 16 Sep 2024 16:40:01 +0100 Message-ID: <CALDnm51ajXGkcj8qU-8jS_82Tw30qEctds00HmOzD=8bsd3Lvw@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Brennan Vincent <brennan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Eli Zaretskii <eliz@HIDDEN>, 73279 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Mon, Sep 16, 2024 at 4:17=E2=80=AFPM Brennan Vincent <brennan@umanwizard= .com> wrote: > As for the regression: yes, it's a regression from 29.4, and in fact I > have bisected to the commit that regressed it: > a8c1559a663d9bc21776e33303251e244f86f0d7 Oh alright, that clears it up. It was an oversight indeed, so I think your patch is TRT. I'll install it in emacs-30. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 15:17:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 11:17:33 2024 Received: from localhost ([127.0.0.1]:53044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqDTo-000673-Nz for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:17:33 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]:14706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1sqDTm-00066n-RR for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 11:17:31 -0400 Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 16 Sep 2024 15:17:06 +0000 X-Fes-Received-For: 73279 <at> debbugs.gnu.org X-Fes-Received-From: <brennan@HIDDEN> From: "Brennan Vincent" <brennan@HIDDEN> To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve In-Reply-To: <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> Date: Mon, 16 Sep 2024 11:17:05 -0400 Message-ID: <8734lz7hn2.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: 73279 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Jo=C3=A3o, Just in case you're not familiar with Rust, here are the detailed repro instructions: 1. Install rust, cargo, and rust-analyzer: https://rustup.rs 2. Create a new project: cargo new my-project 3. Paste the repro recipe from my patch commit message into my-project/src/main.rs As for the regression: yes, it's a regression from 29.4, and in fact I have bisected to the commit that regressed it: a8c1559a663d9bc21776e33303251e244f86f0d7 So this is broken for me in both 30 and 31. Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN> writes: > On Mon, Sep 16, 2024 at 12:28=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wro= te: >> >> > From: Brennan Vincent <brennan@HIDDEN> >> > Date: Sun, 15 Sep 2024 15:22:05 -0400 > >> Jo=C3=A3o, any comments? > > Yes, I have yet to try the reproduction recipe of this alleged problem > but one thing stands out. Brennan, you wrote "as it did in Emacs 29.4". > So this is a recent regression of sorts, is that what you're saying? I d= on't > think that code has changed much over the past years. > > I also don't recognize the timing you're describing, but I'll comment > on that after I've done my investigation. Usually there's a low > chance a patch will easily go through in this very sensitive area > of the code. But a low change is nonetheless non-0 :-) Maybe > Dmitry can also have a look, as he's been tinkering with Eglot > completion lately. > > Jo=C3=A3o T=C3=A1vora
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 13:45:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 09:45:05 2024 Received: from localhost ([127.0.0.1]:51343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sqC2K-0000c0-Ol for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 09:45:05 -0400 Received: from mail-ot1-f54.google.com ([209.85.210.54]:54688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1sqC2I-0000b5-Fy for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 09:45:03 -0400 Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7092dd03223so492048a34.1 for <73279 <at> debbugs.gnu.org>; Mon, 16 Sep 2024 06:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726494223; x=1727099023; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bAXl7SX2xAGw2XqyNPOixPIQM3numhg+kkPeVgVjqv0=; b=Ac5uhmSxJbj66Qvvw46bDy+aRghHHTG538izgTWi4nEfpQzXTDhlnbOf2SJnNiNWG5 6EEoo0b/FVFm1H91io/V5mjohmcxvO4y6xwG6ouGRsB4ASr2Si8HQ3Y36WGkdMXUdpXT QTwlboU0Fr5K/gyrsiT9noOezZcxN+sZhI7XC27uDpnfvqqvDetwvqlIPnJCZy5iTQlZ EuRbYT7B4Wr8YVjfxFqqAiWh1J3++B5YzTbZUhXyq9ciBSo2BWOENiho3nyNM0chtH5s 3Czf2LYx7qsTMaWsLj/QIAGovC7+p2IMoRCBs5pzfAlTC47nhcppcSq2JSryqnuORBIq k2sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726494223; x=1727099023; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bAXl7SX2xAGw2XqyNPOixPIQM3numhg+kkPeVgVjqv0=; b=fYTNhmxnEaPTQKebv9abGtvPfx3KvovfTmxXgRjST1OjKPYO0AnkygmZOz72V62qoH lQNWGWQPowFwdUoVi/W+X4ZYdGRoE2xCrwzVpcOAZUxagXHK9qopzW7est1YkU2mnOpo eyr9CPklFp2gSY4EPGbV5wI1m2BY4N7rWwPkMugLY6kij8ohsOyA3qfVOiUhTcWccuDR MVq5tlO73w05bkfmaRv6+lxS+YgallJvL7ZLwfUuVY4PtOtlg16athNfEat+D2euF+ab Tel2VrBb4HSRM0ohn0/Z1vmJ1lCNeloIjI33UcgcyJNu4y1q2dv2mi8kgQo86pnKZCNm 3vVA== X-Forwarded-Encrypted: i=1; AJvYcCW7AJaqZVLiggdT/LykgX6r5ReHKSPJXJMdaAEjCS2f5if2Ahn+X/2IAp905IvVV89uK+uKcw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxONjxdV6Uo3FzObgqzHzFPPNx174H+ZxtvtGv609H61qqp6HXX i80P7e9SEJeF9eUe5FhycRyUsXRNM7VVZhm46OFmKhsCVgYs3cj50i+qd48RUzhjriwgd0IZ7VE wXideDJZPkydsThUNNH+7EaTmWEs= X-Google-Smtp-Source: AGHT+IGqnK34Gf+pw79x0KYX30+870ejJkzPeqOMBm3AZp3s37Pt3VVmQ4U8Q8m+JGUjIz3/OzAgKFcUXbYQKmtXkqQ= X-Received: by 2002:a05:6830:90d:b0:710:e987:2659 with SMTP id 46e09a7af769-71116c67ac7mr7311426a34.22.1726494223215; Mon, 16 Sep 2024 06:43:43 -0700 (PDT) MIME-Version: 1.0 References: <87v7ywoh7m.fsf@HIDDEN> <86wmjbdehl.fsf@HIDDEN> In-Reply-To: <86wmjbdehl.fsf@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Mon, 16 Sep 2024 14:43:31 +0100 Message-ID: <CALDnm52iNCPyKbPUDs5bPLtnwgaYTvEwKwDtKFANmy1mTrc4BA@HIDDEN> Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve To: Eli Zaretskii <eliz@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73279 Cc: Brennan Vincent <brennan@HIDDEN>, 73279 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Mon, Sep 16, 2024 at 12:28=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote= : > > > From: Brennan Vincent <brennan@HIDDEN> > > Date: Sun, 15 Sep 2024 15:22:05 -0400 > Jo=C3=A3o, any comments? Yes, I have yet to try the reproduction recipe of this alleged problem but one thing stands out. Brennan, you wrote "as it did in Emacs 29.4". So this is a recent regression of sorts, is that what you're saying? I don= 't think that code has changed much over the past years. I also don't recognize the timing you're describing, but I'll comment on that after I've done my investigation. Usually there's a low chance a patch will easily go through in this very sensitive area of the code. But a low change is nonetheless non-0 :-) Maybe Dmitry can also have a look, as he's been tinkering with Eglot completion lately. Jo=C3=A3o T=C3=A1vora
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at 73279) by debbugs.gnu.org; 16 Sep 2024 11:29:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 07:29:11 2024 Received: from localhost ([127.0.0.1]:51173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sq9up-0001SF-Bb for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 07:29:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1sq9un-0001S0-DF for 73279 <at> debbugs.gnu.org; Mon, 16 Sep 2024 07:29:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1sq9uS-0003ot-Rr; Mon, 16 Sep 2024 07:28:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=kgfOUv6FQk0gjePvb9La2XS7WZKGxn8gmtHmMiXf39g=; b=AXjuXy7kT0cQgJd0w/YV p0BRZuq+SL/VRnVcN8KYOJzOGDkjXc7xlv4b1hJ3IMWC0dEQeE+6pI3h2hKXOULeOTeNrMY21G273 pWHHyAqG6uFP1vFKYbP1+kgJuzCmKRPf51uRsnExINb2VVfvkZU3bz4bNfPIcKId3JGfgYJiY4C34 zoJg5qCX+k2RLRobG5sQyKy2GnmOFVQKbFXIdiQpeWYxBPXg8Jp5pRL3RNWxODcR4tZzuWrRUvxXa KR0bBpFmvBRsvOKgKLoF5HO4cKQUvMm4e/c4rClTL2PRTfVuCUVpxvZzbCfg14g5/nVHYbQwVu0GG yb56Fa67K3gNGA==; Date: Mon, 16 Sep 2024 14:28:38 +0300 Message-Id: <86wmjbdehl.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Brennan Vincent <brennan@HIDDEN>, =?iso-8859-1?Q?Jo=E3o_T=E1vo?= =?iso-8859-1?Q?ra?= <joaotavora@HIDDEN> In-Reply-To: <87v7ywoh7m.fsf@HIDDEN> (message from Brennan Vincent on Sun, 15 Sep 2024 15:22:05 -0400) Subject: Re: bug#73279: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve References: <87v7ywoh7m.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73279 Cc: 73279 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Brennan Vincent <brennan@HIDDEN> > Date: Sun, 15 Sep 2024 15:22:05 -0400 > > * lisp/progmodes/eglot.el: use immediate-mode eglot--request for > :completionItem/resolve in eglot-completion-at-point. > > With the previous behavior, we are informing the language server of the > modified state of the buffer after initially inserting the completion, > but before fully resolving the completion item. > > This confuses rust-analyzer (and maybe others, I don't know) and causes > it not to return the correct set of additionalTextEdits. > > A simple Rust program that reveals the issue follows. Put the point > after HashSet and attempt to complete. With the previous behavior, the > language server fails to tell us to insert "use > std::collections::HashSet" at the top of the file. With the new behavior > as of this commit, completion works successfully (as it did in emacs > 29.4). > > struct S<T> { > x: T > } > > impl<T> S<HashSet<T>> { > } > > fn main() {} > --- > lisp/progmodes/eglot.el | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > index 82e99a2c920..e9de099d2cd 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -3229,7 +3229,9 @@ eglot-completion-at-point > :resolveProvider) > (plist-get lsp-comp :data)) > (eglot--request server :completionItem/resolve > - lsp-comp :cancel-on-input t) > + lsp-comp > + :cancel-on-input t > + :immediate t) > lsp-comp)))))) > (when (and (consp eglot--capf-session) > (= (car bounds) (car (nth 0 eglot--capf-session))) > -- > 2.45.2 João, any comments?
bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Sep 2024 19:22:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 15 15:22:29 2024 Received: from localhost ([127.0.0.1]:50525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1spupJ-0007h4-Eo for submit <at> debbugs.gnu.org; Sun, 15 Sep 2024 15:22:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:49168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <brennan@HIDDEN>) id 1spupH-0007gw-M4 for submit <at> debbugs.gnu.org; Sun, 15 Sep 2024 15:22:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <brennan@HIDDEN>) id 1spup3-0006SY-OD for bug-gnu-emacs@HIDDEN; Sun, 15 Sep 2024 15:22:15 -0400 Received: from smtp.umanwizard.com ([54.203.248.109]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <brennan@HIDDEN>) id 1spup1-0001gu-MH for bug-gnu-emacs@HIDDEN; Sun, 15 Sep 2024 15:22:12 -0400 Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 15 Sep 2024 19:22:07 +0000 X-Fes-Received-For: bug-gnu-emacs@HIDDEN X-Fes-Received-From: <brennan@HIDDEN> From: Brennan Vincent <brennan@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Eglot: use immediate-mode eglot--request for :completionItem/resolve X-Envelope-From: 0f861add92db18c6fde521a15fac48e7cbaa9cb1 Mon Sep 17 00:00:00 2001 Date: Sun, 15 Sep 2024 15:22:05 -0400 Message-ID: <87v7ywoh7m.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost Received-SPF: pass client-ip=54.203.248.109; envelope-from=brennan@HIDDEN; helo=smtp.umanwizard.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) * lisp/progmodes/eglot.el: use immediate-mode eglot--request for :completionItem/resolve in eglot-completion-at-point. With the previous behavior, we are informing the language server of the modified state of the buffer after initially inserting the completion, but before fully resolving the completion item. This confuses rust-analyzer (and maybe others, I don't know) and causes it not to return the correct set of additionalTextEdits. A simple Rust program that reveals the issue follows. Put the point after HashSet and attempt to complete. With the previous behavior, the language server fails to tell us to insert "use std::collections::HashSet" at the top of the file. With the new behavior as of this commit, completion works successfully (as it did in emacs 29.4). struct S<T> { x: T } impl<T> S<HashSet<T>> { } fn main() {} --- lisp/progmodes/eglot.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 82e99a2c920..e9de099d2cd 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3229,7 +3229,9 @@ eglot-completion-at-point :resolveProvider) (plist-get lsp-comp :data)) (eglot--request server :completionItem/resolve - lsp-comp :cancel-on-input t) + lsp-comp + :cancel-on-input t + :immediate t) lsp-comp)))))) (when (and (consp eglot--capf-session) (= (car bounds) (car (nth 0 eglot--capf-session))) -- 2.45.2
Brennan Vincent <brennan@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#73279
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.