[PATCH 4 of 6] rust-chg: add struct holding information needed to spawn server process

Yuya Nishihara yuya at tcha.org
Sun Oct 14 08:34:01 EDT 2018


On Sun, 14 Oct 2018 13:48:31 +0200, Gregory Szorc wrote:
> On Sun, Oct 14, 2018 at 10:29 AM Yuya Nishihara <yuya at tcha.org> wrote:
> > +    /// Temporary socket path for this client process.
> > +    fn temp_sock_path(&self) -> PathBuf {
> > +        let src = self.base_sock_path.as_os_str().as_bytes();
> > +        let mut buf = Vec::with_capacity(src.len() + 6);
> 
> This magic number to hold the formatted pid scared me a bit. But Rust
> should guarantee memory safety. I wish this could be expressed in terms of
> the size of another variable that will occupy the space. But meh.

It's just the initial allocation size, so I didn't care much. Perhaps, I
can add some inline comment.


More information about the Mercurial-devel mailing list